Merge lp:~maddevelopers/mg5amcnlo/2.3.3_PY8_install_cmd into lp:~maddevelopers/mg5amcnlo/2.3.4

Proposed by Valentin Hirschi
Status: Rejected
Rejected by: Olivier Mattelaer
Proposed branch: lp:~maddevelopers/mg5amcnlo/2.3.3_PY8_install_cmd
Merge into: lp:~maddevelopers/mg5amcnlo/2.3.4
Diff against target: 156743 lines (+86724/-56942)
271 files modified
MadSpin/decay.py (+61/-22)
MadSpin/interface_madspin.py (+26/-11)
Template/LO/Cards/pythia8_card_default.dat (+62/-0)
Template/LO/Cards/run_card.dat (+44/-47)
Template/LO/Source/PDF/makefile (+2/-2)
Template/LO/Source/PDF/pdf_lhapdf.f (+4/-3)
Template/LO/Source/PDF/pdg2pdf_lhapdf6.f (+10/-2)
Template/LO/Source/cuts.inc (+7/-3)
Template/LO/Source/make_opts (+7/-7)
Template/LO/Source/run.inc (+8/-0)
Template/LO/SubProcesses/cuts.f (+1750/-1317)
Template/LO/SubProcesses/genps.f (+1/-1)
Template/LO/SubProcesses/makefile (+2/-2)
Template/LO/SubProcesses/myamp.f (+3/-2)
Template/LO/SubProcesses/refine.sh (+40/-13)
Template/LO/SubProcesses/reweight.f (+8/-6)
Template/LO/SubProcesses/setcuts.f (+192/-89)
Template/LO/SubProcesses/unwgt.f (+62/-11)
Template/LO/bin/internal/run_delphes3 (+30/-12)
Template/LO/bin/internal/store4grid (+0/-3)
Template/LO/bin/madevent (+0/-1)
Template/NLO/MCatNLO/PY8Analyzer/py8an_HwU_pp_h.f (+1/-1)
Template/NLO/Source/make_opts.inc (+4/-4)
Template/NLO/Source/setrun.f (+4/-0)
Template/NLO/SubProcesses/BinothLHA.f (+8/-4)
Template/NLO/SubProcesses/check_poles.f (+2/-0)
Template/NLO/SubProcesses/madfks_plot.f (+4/-0)
Template/NLO/SubProcesses/makefile_fks_dir (+8/-8)
Template/NLO/SubProcesses/makefile_loop.inc (+1/-0)
Template/NLO/SubProcesses/reweight0.inc (+1/-1)
Template/NLO/SubProcesses/reweight_xsec_events.f (+4/-0)
Template/NLO/SubProcesses/symmetry_fks_test_MC.f (+12/-3)
Template/NLO/SubProcesses/symmetry_fks_test_ME.f (+12/-2)
Template/NLO/SubProcesses/write_event.f (+10/-7)
Template/NLO/Utilities/VetoPrefactors/resum_reweighter.py (+1/-1)
Template/NLO/Utilities/VetoPrefactors/virt_reweighter.py (+3/-3)
Template/NLO/Utilities/thrbdec2_usage.f (+430/-0)
Template/RWGTNLO/makefile (+1/-1)
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 (+3/-1)
UpdateNotes.txt (+38/-1)
VERSION (+3/-2)
aloha/aloha_writers.py (+16/-3)
aloha/create_aloha.py (+2/-2)
input/.mg5_configuration_default.txt (+21/-5)
madgraph/core/base_objects.py (+13/-8)
madgraph/interface/amcatnlo_interface.py (+3/-1)
madgraph/interface/amcatnlo_run_interface.py (+116/-81)
madgraph/interface/common_run_interface.py (+1297/-136)
madgraph/interface/extended_cmd.py (+68/-10)
madgraph/interface/launch_ext_program.py (+5/-6)
madgraph/interface/loop_interface.py (+9/-2)
madgraph/interface/madevent_interface.py (+1151/-310)
madgraph/interface/madgraph_interface.py (+239/-102)
madgraph/interface/madweight_interface.py (+1/-1)
madgraph/interface/master_interface.py (+2/-1)
madgraph/interface/reweight_interface.py (+18/-4)
madgraph/iolibs/export_cpp.py (+4/-4)
madgraph/iolibs/export_fks.py (+55/-15)
madgraph/iolibs/export_v4.py (+150/-50)
madgraph/iolibs/file_writers.py (+1/-1)
madgraph/iolibs/template_files/addmothers.f (+5/-4)
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/loop_optimized/mp_compute_loop_coefs.inc (+14/-4)
madgraph/iolibs/template_files/madevent_makefile_source (+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/loop/loop_exporters.py (+136/-29)
madgraph/madevent/gen_crossxhtml.py (+228/-43)
madgraph/madevent/gen_ximprove.py (+4/-4)
madgraph/madevent/sum_html.py (+6/-2)
madgraph/various/banner.py (+1138/-42)
madgraph/various/cluster.py (+2/-0)
madgraph/various/combine_plots.py (+2/-2)
madgraph/various/diagram_symmetry.py (+1/-1)
madgraph/various/histograms.py (+298/-44)
madgraph/various/lhe_parser.py (+222/-122)
madgraph/various/misc.py (+140/-4)
madgraph/various/plot_djrs.py (+163/-0)
madgraph/various/process_checks.py (+76/-29)
madgraph/various/q_polynomial.py (+22/-0)
mg5decay/decay_objects.py (+2/-1)
models/check_param_card.py (+26/-0)
models/import_ufo.py (+21/-8)
models/loop_MSSM/.restrict_parallel_test.dat (+0/-532)
models/loop_MSSM/.restrict_parallel_test_gogo.dat (+0/-532)
models/loop_MSSM/CT_couplings.py (+0/-22863)
models/loop_MSSM/CT_vertices.py (+0/-7619)
models/loop_MSSM/MSSM_NLO.log (+0/-87)
models/loop_MSSM/__init__.py (+0/-48)
models/loop_MSSM/coupling_orders.py (+0/-17)
models/loop_MSSM/couplings.py (+0/-6439)
models/loop_MSSM/function_library.py (+0/-71)
models/loop_MSSM/lorentz.py (+0/-198)
models/loop_MSSM/object_library.py (+0/-377)
models/loop_MSSM/parameters.py (+0/-1756)
models/loop_MSSM/particles.py (+0/-814)
models/loop_MSSM/propagators.py (+0/-35)
models/loop_MSSM/restrict_default.dat (+0/-526)
models/loop_MSSM/restrict_test.dat (+0/-532)
models/loop_MSSM/vertices.py (+0/-9119)
models/loop_MSSM/write_param_card.py (+0/-207)
tests/IOTests.py (+1/-1)
tests/acceptance_tests/test_cmd.py (+12/-11)
tests/acceptance_tests/test_cmd_amcatnlo.py (+1/-1)
tests/acceptance_tests/test_cmd_madevent.py (+22/-22)
tests/acceptance_tests/test_histograms.py (+1/-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 (+11/-265)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%TIR_interface.f (+25/-6)
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 (+117/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_dxu_wp%V0_dxu_wp%mp_compute_loop_coefs.f (+13/-3)
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 (+11/-265)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%TIR_interface.f (+25/-6)
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 (+117/-11)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/IOExportFKSTest/test_ppw_fksall/%SubProcesses%P0_udx_wp%V0_udx_wp%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/CKKWL_djrs_output.HwU (+1665/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/CKKWL_djrs_output.gnuplot (+362/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/MLM_djrs_output.HwU (+1665/-0)
tests/input_files/IOTestsComparison/IOHistogramTest/DJR_histograms/MLM_djrs_output.gnuplot (+362/-0)
tests/input_files/IOTestsComparison/IOTest_Histogram/gnuplot_histo_output/HistoOut.gnuplot (+108/-75)
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 (+116/-10)
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 (+116/-10)
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/MadLoop_output_from_the_interface/TIR_output/%ggttx_IOTest%SubProcesses%MadLoopCommons.f (+143/-11)
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/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%COLLIER_interface.f (+732/-0)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%CT_interface.f (+19/-274)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%GOLEM_interface.f (+2/-1)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%TIR_interface.f (+25/-6)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%check_sa.f (+2/-0)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%loop_matrix.f (+117/-11)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/TestCmdMatchBox/MatchBoxOutput/%TEST%SubProcesses%P1_uux_uux%unique_id.inc (+2/-0)
tests/input_files/IOTestsComparison/TestMadWeight/modification_to_cuts/cuts.f (+447/-26)
tests/input_files/IOTestsComparison/long_ML_SMQCD_default/dux_mumvmxg/check_sa.f (+2/-0)
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/check_sa.f (+2/-0)
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/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/TIR_interface.f (+13/-5)
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 (+111/-10)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/dux_mumvmxg/mp_compute_loop_coefs.f (+13/-3)
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/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/TIR_interface.f (+13/-5)
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 (+111/-10)
tests/input_files/IOTestsComparison/long_ML_SMQCD_optimized/gg_wmtbx/mp_compute_loop_coefs.f (+13/-3)
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/check_sa.f (+2/-0)
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/check_sa.f (+2/-0)
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/check_sa.f (+2/-0)
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 (+2/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/TIR_interface.f (+13/-5)
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 (+111/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/ddx_ttx/mp_compute_loop_coefs.f (+13/-3)
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/CT_interface.f (+2/-1)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/TIR_interface.f (+13/-5)
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 (+111/-10)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/mp_compute_loop_coefs.f (+13/-3)
tests/input_files/IOTestsComparison/short_ML_SMQCD_optimized/gg_ttx/unique_id.inc (+2/-0)
tests/input_files/MLM_djrs.dat (+1665/-0)
tests/input_files/loop_MSSM/CT_couplings.py (+22863/-0)
tests/input_files/loop_MSSM/CT_vertices.py (+7619/-0)
tests/input_files/loop_MSSM/MSSM_NLO.log (+87/-0)
tests/input_files/loop_MSSM/README.txt (+7/-0)
tests/input_files/loop_MSSM/__init__.py (+48/-0)
tests/input_files/loop_MSSM/coupling_orders.py (+17/-0)
tests/input_files/loop_MSSM/couplings.py (+6439/-0)
tests/input_files/loop_MSSM/function_library.py (+71/-0)
tests/input_files/loop_MSSM/lorentz.py (+198/-0)
tests/input_files/loop_MSSM/object_library.py (+377/-0)
tests/input_files/loop_MSSM/parameters.py (+1756/-0)
tests/input_files/loop_MSSM/particles.py (+814/-0)
tests/input_files/loop_MSSM/propagators.py (+35/-0)
tests/input_files/loop_MSSM/restrict_default.dat (+526/-0)
tests/input_files/loop_MSSM/restrict_parallel_test.dat (+532/-0)
tests/input_files/loop_MSSM/restrict_parallel_test_gogo.dat (+532/-0)
tests/input_files/loop_MSSM/restrict_test.dat (+532/-0)
tests/input_files/loop_MSSM/vertices.py (+9119/-0)
tests/input_files/loop_MSSM/write_param_card.py (+207/-0)
tests/parallel_tests/test_ML5.py (+1/-2)
tests/parallel_tests/test_ML5MSSMQCD.py (+5/-10)
tests/parallel_tests/test_aloha.py (+91/-91)
tests/time_db (+287/-226)
tests/unit_tests/interface/test_madevent.py (+8/-2)
tests/unit_tests/iolibs/test_export_v4.py (+6/-3)
tests/unit_tests/iolibs/test_histograms.py (+88/-0)
tests/unit_tests/various/test_banner.py (+150/-2)
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.3.3_PY8_install_cmd
Reviewer Review Type Date Requested Status
Olivier Mattelaer Disapprove
Rikkert Frederix Needs Fixing
Paolo Torrielli Needs Fixing
Stefan Prestel Pending
Review via email: mp+286726@code.launchpad.net

Description of the change

This branch features two things:

1) A more advanced implementation of the 'install' command for the more complicated common dependencies of MG5_aMC: lhapdf5, lhapdf6, Pythia8, hepmc as well as the 'mg5amc_pythia8_interface'

2) A streamlined interface at LO to the showering of the produced .lhe events with Pythia8.

I shortly describe each aspect:

1)
This advanced installation is done via a separate set of installer scripts, hosted on (please quickly review these as well):

lp:~maddevelopers/mg5amcnlo/HEPToolsInstallers

These installers are automatically updated on the MG servers, and when the user wants to install a dependency, he firsts downloads these installers which will do the job for him.
The advantage is that if we want to modify the installation routines (to make it work on some specific setup we had overlook or simply to update the version used for some dependency), we can directly update HEPToolsInstallers without having to release a new version of MG5.
The script I wrote in HEPToolsInstallers is flexible so that it will be easy in the future to automatically install more complicated dependencies. In essence, it is a mini-package manager.
As a by-product of this implementation, it now also possible to install from madgraph the following dependencies (with the same 'install' command):

boost, zlib and hepmc

Special care was given to nicely handle the mutual dependency of Pythia8 and MG5 to LHAPDF. In other terms, when installing pythia8 automatically, MG5 makes several check and efforts in order to insure that Pythia8 is linked to the same LHAPDF version as the one specified in MG5 configuration.

2) When launching a process, one no longer turn 'pythia=ON/OFF' but instead modify the parameter 'SHOWER=' which can take the value 'PYTHIA6' or 'PYTHIA8' depending on what is installed (thanks Olivier for that). Same for detector simulation.

Both MLM and CKKW-L merging are supported as well as the automatic variation of the merging scale to evaluate systematics. This used to be done by SysCalc in Pythia8 and is now entirely performed by the Pythia8 shower driver. However, the choice of the variational merging scales to consider still happens via the run_card parameter 'sys_matchscale'.

Speaking of which, this driver is hosted on the launchpad branch:
   lp:~maddevelopers/mg5amcnlo/MG5aMC_PY8_interface
for which synchronized copy is kept on MadGraph servers and which is used for the function
'install mg5amc_pythia8_interface'
Int his way, both us and the pythia8 developers can update it without having to rerelease either Pythia8 or MadGraph5. Version compatibility by a dedicated check upon both the installation and usage of the this interface.

This implementation should also serve as a basis for future improvements for handling Pythia8.
In particular, the implementation of the pythia8 card in the class PYCard of 'madgraph/various/banner.py' should allow to easily tweak PY8 parameters (and their visibility to the user) in future developments. For example, the 'subruns' structure of the pythia8 card is fully supported (i.e. listing several .lhe to be processed within one single card, and each with specific parameters)

In order to test this branch you can start by simply doing:

MG5_aMC>install hepmc
MG5_aMC>install pythia8
MG5_aMC>install mg5amc_py8_interface

(normally the installer would automatically install hepmc and pythia8 for you when installing 'mg5amc_py8_interface' but it is better to force the installation by hand here otherwise my installer will find your system-wide installation of these tools and use it, even though they are not the development versions compatible with this LO interface)

Then you can do

MG5_aMC>generate p p > z > mu+ mu-
MG5_aMC>add process p p > z > mu+ mu- j
MG5_aMC>add process p p > z > mu+ mu- j j
MG5_aMC>output MyMLMTest
MG5_aMC>launch
>shower=PYTHIA8 (or roll the options [assuming you have installed pythia6 too] by pressing '1' several times)
And possibly change some options (commands below are not mandatory)
>set xqcut 12
>set sys_matchscale 20 30 50 60
>set JetMatching:nJetMax 2
>set JetMatching:qCut 40
(you can try to tab-complete 'set pythia8_card ' to see all PY8 parameter visible to the user and you can edit the card directly if you want to add one that MG5aMC doesn't know about)

Ok now you can launch, and if everything went well you should be able to follow the shower run live via its log file and eventually get the merging plots, directly available from within the HTML page.

To post a comment you must log in.
355. By Valentin Hirschi

1. Temporarily commented out qCutMin since the PY8 driver is not yet ready for it.

356. By Valentin Hirschi

1. Added an IOTest for the histograms.py functionality of reading DJR plots and writing a gnuplot output
   for them.

Revision history for this message
Paolo Torrielli (paolo-torrielli) wrote :
Download full text (19.3 KiB)

Hi Valentin,
thanks for this interesting branch.

I tried to install lhapdf5 on my laptop (mac os 10.9), and it doesn't with the following error

---------------------------------------------------------------
   You are installing 'lhapdf5', please cite ref(s).
         [arXiv:0605240]
   when using results produced with this tool.
---------------------------------------------------------------
Downloading the HEPToolInstaller at:
   http://madgraph.hep.uiuc.edu/Downloads/HEPToolsInstaller/HEPToolsInstaller_V26.tar.gz
Now installing lhapdf5. Be patient...
Installer HEPToolInstaller.py is now processing the following command:
   /Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/HEPToolsInstallers/HEPToolInstaller.py lhapdf5 --prefix=/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools --mg5_path=/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd --mg5amc_py8_interface_tarball=http://madgraph.phys.ucl.ac.be/Downloads/MG5aMC_PY8_interface/MG5aMC_PY8_interface_V1.0.tar.gz
Downloading 'lhapdf5' sources...
Fetching data with command:
  curl -OL http://www.hepforge.org/archive/lhapdf/lhapdf-5.9.0.tar.gz
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 349 100 349 0 0 1354 0 --:--:-- --:--:-- --:--:-- 2624
100 1207k 100 1207k 0 0 537k 0 0:00:02 0:00:02 --:--:-- 746k
Installing tool 'lhapdf5'...
(you can follow the installation progress by running the command below in a separate terminal)
  tail -f /Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/lhapdf5/lhapdf5_install.log
Traceback (most recent call last):
  File "/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/HEPToolsInstallers/HEPToolInstaller.py", line 715, in <module>
    install_with_dependencies(target_tool,is_main_target=True)
  File "/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/HEPToolsInstallers/HEPToolInstaller.py", line 693, in install_with_dependencies
    exec('install_%s(tmp_path)'%target)
  File "<string>", line 1, in <module>
  File "/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/HEPToolsInstallers/HEPToolInstaller.py", line 364, in install_lhapdf5
    stderr=lhapdf5_log)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 524, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
Command "install lhapdf5" interrupted with error:
InvalidCmd : Installation of lhapdf5 failed.
Please report this bug on https://bugs.launchpad.net/madgraph5
More information is found in 'MG5_debug'.
Please attach this file to your report.

Installing pythia8 does not work with the following error

MG5...

review: Needs Fixing
Revision history for this message
Valentin Hirschi (valentin-hirschi) wrote :
Download full text (20.8 KiB)

> Hi Valentin,
> thanks for this interesting branch.

Hi Paolo,

Thanks for having quickly started to look at this.

>
> I tried to install lhapdf5 on my laptop (mac os 10.9), and it doesn't with the
> following error
>
> ---------------------------------------------------------------
> You are installing 'lhapdf5', please cite ref(s).
> [arXiv:0605240]
> when using results produced with this tool.
> ---------------------------------------------------------------
> Downloading the HEPToolInstaller at:
> http://madgraph.hep.uiuc.edu/Downloads/HEPToolsInstaller/HEPToolsInstaller_
> V26.tar.gz
> Now installing lhapdf5. Be patient...
> Installer HEPToolInstaller.py is now processing the following command:
> /Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/
> HEPToolsInstallers/HEPToolInstaller.py lhapdf5 --prefix=/Users/paolotorrielli/
> WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools
> --mg5_path=/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd -
> -mg5amc_py8_interface_tarball=http://madgraph.phys.ucl.ac.be/Downloads/MG5aMC_
> PY8_interface/MG5aMC_PY8_interface_V1.0.tar.gz
> Downloading 'lhapdf5' sources...
> Fetching data with command:
> curl -OL http://www.hepforge.org/archive/lhapdf/lhapdf-5.9.0.tar.gz
> % Total % Received % Xferd Average Speed Time Time Time
> Current
> Dload Upload Total Spent Left Speed
> 100 349 100 349 0 0 1354 0 --:--:-- --:--:-- --:--:-- 2624
> 100 1207k 100 1207k 0 0 537k 0 0:00:02 0:00:02 --:--:-- 746k
> Installing tool 'lhapdf5'...
> (you can follow the installation progress by running the command below in a
> separate terminal)
> tail -f /Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HE
> PTools/lhapdf5/lhapdf5_install.log
> Traceback (most recent call last):
> File "/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPT
> ools/HEPToolsInstallers/HEPToolInstaller.py", line 715, in <module>
> install_with_dependencies(target_tool,is_main_target=True)
> File "/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPT
> ools/HEPToolsInstallers/HEPToolInstaller.py", line 693, in
> install_with_dependencies
> exec('install_%s(tmp_path)'%target)
> File "<string>", line 1, in <module>
> File "/Users/paolotorrielli/WORK/Research/MG5_aMC/2.3.3_PY8_install_cmd/HEPT
> ools/HEPToolsInstallers/HEPToolInstaller.py", line 364, in install_lhapdf5
> stderr=lhapdf5_log)
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
> /subprocess.py", line 524, in call
> return Popen(*popenargs, **kwargs).wait()
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
> /subprocess.py", line 711, in __init__
> errread, errwrite)
> File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
> /subprocess.py", line 1308, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
> Command "install lhapdf5" interrupted with error:
> InvalidCmd : Installation of lhapdf5 failed.
> Please report this bug ...

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

Dear reviewers,

We looked at the issue with Stefan and the error you were getting when installing Pythia8 was because of a part of both the main89-madgraph.cc example code and the MG5_aMC_PY8 interface drivers which was wrong (and not very well tested because it only gets compiled when using the non-hacked version of HepMC for writing named weights).

This means that it would have been fine if you had installed HEPMC with MG5aMC as well prior to your Pythia8 installation.
Anyway, now this issue has been fixed (both in the pythia8 tarball [which is lighter now that it has been stripped from the .lhe examples]) and in the online interface driver. So it should work with any version of HepMC.

Please give it another try and let me know.
Thanks again for your testing,

Cheers

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

Hi Valentin,

This didn't fix the problem on my LINUX desktop machine. It still doesn't compile (problem with rsync); see e-mail I sent a couple of days ago.

On my mac laptop it now compiles correctly---apart from the fact that it cannot find any dependencies automatically. If I run the installer by hand, it does seem to find the dependencies:

[ Rikkert@MacBook-Air ~/Documents/Physics/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/HEPToolsInstallers ]$ ./HEPToolInstaller.py pythia8
Installer HEPToolInstaller.py is now processing the following command:
   ./HEPToolInstaller.py pythia8
'pythia8' dependency 'hepmc' found at:
  /usr/local
'pythia8' dependency 'zlib' found at:
  /usr
'pythia8' dependency 'lhapdf6' found at:
  /usr/local
Downloading 'pythia8' sources...

Cheers,
Rik

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

Hi Valentin,

Very nice branch. It's really cool all the interesting way the code is improving those days.
I particularly like the change in the card edition part (maybe I did those but I do not remember)

Here is my review:
First some functionalities which does not work on this branch

1) The output pythia8 does not work in this branch. This need to be fixed for sure.
   - You change the comment for the PY8 path in the configuration file, is that related?

2) The standard plot routines (MA4) does not work anymore:
   - I do not have any plot either at parton level
   - I do not have any plot for after the shower (even if the lhe file in order to do such plot is created)

3) if I type the function shower, I have as question:
Which programs do you want to run?
    0 / auto : running existing cards
    1 / pythia : Pythia
    2 / pgs : Pythia + PGS
    3 / delphes : Pythia + Delphes.
 [0, 1, 2, 3, auto, pythia, pgs, delphes][60s to answer]
This need to be updated to the new format.
At the end of the run, the code ask me a second question:
Which programs do you want to run?
    0 / auto : running existing cards
    1 / pythia8 : Pythia8
    3 / delphes : Pythia8 + Delphes.
 [0, 1, 3, auto, pythia8, delphes][60s to answer]
 (This probably happens only if you have both PY6 and PY8 installed)

One general question (having those answer will allow me to review that part of the modification)

1) I have a bunch of question related to the CKKW-L support that you have added in MG:
   a) Where can I find some documentation for how to run CKKW-L?
      - In particular what is the meaning of is_pdg_for_merging_cut
      - Can I do p p > w+ [0-3]j, w+ > j j
        Is the jet comming from the W are correctly not handle by the Durham kt/ PT lund cut?
        (If so we have to update the cut_decays comment)
   b) Is the modification of durham kt cut retro compatible?
      - if ATLAS use a old run_card, will they have the same results?
   c) What is the official support for CKKWL?
      - in term of user visibility
      - in term of user support
      - in term of code validation
      - in term of long term plan

Following some more technical/code related remark

1) In the class common_run_interface you define the function:
def help_pythia8(self):
def help_shower(self):
I would naively expect to have those in the madevent interface (like check_pythia8)

2) I would suggest to refactorise the code between the following comment:
+ ########################################################################
+ ### Special setup of the Hidden parameters in the card for each MG type
+ # of run
in the do_pythia8 command
and to put those command in the PY8 card directly. This would make more sense and allow to
have a cleaner do_pythia8

3) Why do you recommend to install:
install mg5amc_py8_interface
if someone install Delphes2/pythia-pgs
should not it be "install pythia8"?
What is the logic behind this?

4) One problem with the automatic download of PY8/... couple to the auto-update of MG5
is that we can have recent version of MG5 with old version of PY8/...
I would propose to add a way to track the latest version online at the same l...

Read more...

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

Hi Rik,

> Hi Valentin,
>
> This didn't fix the problem on my LINUX desktop machine. It still doesn't
> compile (problem with rsync); see e-mail I sent a couple of days ago.

This does not seem related to my branch, although you claim that you could install Pythia8.2 on this machine yourself, so it somehow must be related to what I do. Your problem seems to be:

rsync -a bin/* /tuph/t30/space/frederix/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/pythia8//bin --exclude .svn
rsync: chgrp "/tuph/t30/space/frederix/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/pythia8/bin/.pythia8-config.QThxt3" failed: Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1183) [sender=3.1.0]
make: *** [install] Error 23

So could I ask you to download the pythia8 tarball

http://slac.stanford.edu/~prestel/pythia82151.tar.gz

untar it somewhere and then install it by runnning:

./configure --prefix=/tuph/t30/space/frederix/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/pythia8/ --with-hepmc2=/space/rikkert/rivet/local --with-hepmc2-include=/space/rikkert/rivet/local/include --with-gzip=/tuph/t30/space/frederix/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/zlib --with-lhapdf6=/home/t30/ben/ga63zot/Documents/Physics/LHAPDF-6.1.6/build --with-lhapdf6-plugin=LHAPDF6.h --with-boost=default
make
make install

If it goes through this means that the problem comes from the fact that I do this installation from an automatically generated directory typically placed in /tmp/ or /var/ (it is done with 'tempfile.mkdtemp') and that you have only limited rights from there.
So I guess that if this is the problem I should simply use some directory directly in HEPTools then.

> On my mac laptop it now compiles correctly---apart from the fact that it
> cannot find any dependencies automatically. If I run the installer by hand, it
> does seem to find the dependencies:
>
> [ Rikkert@MacBook-Air
> ~/Documents/Physics/MG5_aMC/2.3.3_PY8_install_cmd/HEPTools/HEPToolsInstallers
> ]$ ./HEPToolInstaller.py pythia8
> Installer HEPToolInstaller.py is now processing the following command:
> ./HEPToolInstaller.py pythia8
> 'pythia8' dependency 'hepmc' found at:
> /usr/local
> 'pythia8' dependency 'zlib' found at:
> /usr
> 'pythia8' dependency 'lhapdf6' found at:
> /usr/local
> Downloading 'pythia8' sources...

Ok I added /usr/local/lib and /usr/lib as default lookup path, this should resolve the problem.
I don't want to update the servers before the issue above regarding rsync is solved, so don't test the above yet but tell me if you managed the installation by hand of the development version of Pythia 8 I specified.

>
> Cheers,
> Rik

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

Dea rreviewers,

We have still small fixes pending for MLM and for runs without SysCalc, so please as a first testing, I suggest you run the following commands on top of the installation of the mg5amc_pythia8_interface:

MG5_aMC>install SysCalc

Please report any failure of the automatic installation of SysCalc, because this is something that must work in this branch now (notice that this one does not proceed through the HEPToolsInstaller manager).

Once both SysCalc and the mg5amc_pythia8_interface are successfully installed, I suggest you try the following simulation (hence avoiding the pending problems in MLM and non-SysCalc runs).
Having your feedback on this type of runs would already help a lot towards making progress in this review:

MG5_aMC>generate p p > z > mu+ mu-
MG5_aMC>add process p p > z > mu+ mu- j
MG5_aMC>add process p p > z > mu+ mu- j j
MG5_aMC>output MyCKKWLTest
MG5_aMC>launch

Now turn on Pythia8 shower with the command below, or by rolling the options by pressing '1' several times:
(Several options are available if you have installed pythia6 too).

>shower=PYTHIA8
>[enter] or '0'

Now setup lhapdf (necessary for SysCalc)

>set pdlabel lhapdf
>set lhaid 11000
>set sys_pdf CT10nlo.LHgrid

And change the following run_card parameters so as to turn on CKKWL merging

>set xqcut 0
>set ickkw 0
>set ktdurham 20
>set use_syst True
>set sys_matchscale 20 30 50 60

And then the following Pythia8 shower card options related to the details of the CKKWL merging

>set Merging:Process 'pp>LEPTONS,NEUTRINOS'
>set Merging:TMS 40

You can now start the run as usual by typing enter or '0'.

Most of the time should then be spent in the shower which you should be able to follow from the log file, as suggested. Beware that it generates the heavy hepmc file as it goes.

Finally, you can assess the quality of the CKKW-L merging with the plots automatically generated and available on the HTML summary webpage, at:

<MG_ROOT_DIR>/MyCKKWLTest/index.html

where the plot pages is accessible by clicking on:

> Results and Event Database

leading you to a summary page of the various runs with links to pages showing specific aspects of the run. One of special interest is the 'DJR(plot)' link sending you to a page where all generated merging plots (with all uncertainties) are available in a table.

Let us know your comments on the above and how the runs went.

357. By Valentin Hirschi

1. Fixed a small issue in the plot creation of common_run_interface.py

358. By Olivier Mattelaer

fix the problem that I point for pythia/delphes command to select the type of run

359. By Olivier Mattelaer

adding help for the card edition

360. By Valentin Hirschi

1. Merged histograms.py with the large changes Rik did in this file for
   his branch improved pdf/scale reweighting.

361. By Valentin Hirschi

1. Updated default values for some options in the plotter.

362. By Valentin Hirschi

1. Updated the histograms.py IOTest

363. By Valentin Hirschi

1. Updated histograms.py and added JetMatching:ShowerKt parameter

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

Hi Valentin,

One additional problem that I found:
I can not run any PY8 analysis with the PY8 version installed:
(This is annoying if I want to check the problem of the PY8 analysis which did not handle the
reweighting correctly)

Sorry for the annoying report

Olivier

Here is the detail of the crash:
INFO: Compiling MCatNLO for PYTHIA8...
WARNING: 'dl' was added to extralibs from the shower_card.dat.
It is needed for the correct running of PY8.2xx.
If this library cannot be found on your system, a crash will occur.
Undefined symbols for architecture x86_64:
  "_gzclose", referenced from:
      Pythia8::gzstreambuf::close() in libpythia8.a(Streams.o)
      Pythia8::gzstreambase::~gzstreambase() in libpythia8.a(Streams.o)
      Pythia8::gzstreambase::close() in libpythia8.a(Streams.o)
      Pythia8::gzstreambuf::~gzstreambuf() in libpythia8.a(Streams.o)
  "_gzopen", referenced from:
      Pythia8::gzstreambuf::open(char const*, int) in libpythia8.a(Streams.o)
      Pythia8::gzstreambase::open(char const*, int) in libPythia8 compilation did not succeed, exiting
from:
      Pythia8::gzstreambuf::underflow() in libpythia8.a(Streams.o)
  "_gzwrite", referenced from:
      Pythia8::gzstreambuf::flush_buffer() in libpythia8.a(Streams.o)
      Pythia8::gzstreambuf::overflow(int) in libpythia8.a(Streams.o)
      Pythia8::gzstreambuf::sync() in libpythia8.a(Streams.o)
      Pythia8::gzstreambuf::~gzstreambuf() in libpythia8.a(Streams.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Pythia82] Error 1

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

> Hi Valentin,
>
> One additional problem that I found:
> I can not run any PY8 analysis with the PY8 version installed:
> (This is annoying if I want to check the problem of the PY8 analysis which did
> not handle the
> reweighting correctly)
>

This is because the Pythia8 version we have is compiled so as to support zipped event files so that when compiling the driver, you need to add the 'zlib' library.
This is not a problem for our LO interface because the driver is compiled directly with the Pythia8 makefile which knowns what dependencies where turned on when it was installed.

Unfortunately, as you know the aMCatNLO interface to shower compiles its driver completely independently of Pythia8, so that you have to specify yourself what libraries to use when compiling the driver. You can therefore cure your problem by adding the 'libz' library to the list of external libraries to link in the shower_card, i.e.

EXTRALIBS = stdhep Fmcfio
->
EXTRALIBS = stdhep Fmcfio z

And with the change above it works (at least it does for me).

I don't know what would be the best way to have this be done automatically (and also for possible other dependencies of Pythia8). I don't think that we can do it in an elegant way within the aMC@NLO way of interfacing to shower, so for now it is best to leave it to the user to do it by hand.

> Sorry for the annoying report
>
> Olivier
>
> Here is the detail of the crash:
> INFO: Compiling MCatNLO for PYTHIA8...
> WARNING: 'dl' was added to extralibs from the shower_card.dat.
> It is needed for the correct running of PY8.2xx.
> If this library cannot be found on your system, a crash will occur.
> Undefined symbols for architecture x86_64:
> "_gzclose", referenced from:
> Pythia8::gzstreambuf::close() in libpythia8.a(Streams.o)
> Pythia8::gzstreambase::~gzstreambase() in libpythia8.a(Streams.o)
> Pythia8::gzstreambase::close() in libpythia8.a(Streams.o)
> Pythia8::gzstreambuf::~gzstreambuf() in libpythia8.a(Streams.o)
> "_gzopen", referenced from:
> Pythia8::gzstreambuf::open(char const*, int) in libpythia8.a(Streams.o)
> Pythia8::gzstreambase::open(char const*, int) in libPythia8 compilation
> did not succeed, exiting
> from:
> Pythia8::gzstreambuf::underflow() in libpythia8.a(Streams.o)
> "_gzwrite", referenced from:
> Pythia8::gzstreambuf::flush_buffer() in libpythia8.a(Streams.o)
> Pythia8::gzstreambuf::overflow(int) in libpythia8.a(Streams.o)
> Pythia8::gzstreambuf::sync() in libpythia8.a(Streams.o)
> Pythia8::gzstreambuf::~gzstreambuf() in libpythia8.a(Streams.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make: *** [Pythia82] Error 1

364. By Valentin Hirschi

1. Changed the suggestion to install pythia8

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

> Hi Valentin,
>
> Very nice branch. It's really cool all the interesting way the code is
> improving those days.
> I particularly like the change in the card edition part (maybe I did those but
> I do not remember)

Well it is OUR common branch, which underlies our work for the PY8-MG5aMC enhanced automated interface+merging at LO.

> Here is my review:
> First some functionalities which does not work on this branch
>
> 1) The output pythia8 does not work in this branch. This need to be fixed for
> sure.
> - You change the comment for the PY8 path in the configuration file, is
> that related?

I don't think so, because the information on screen shows that it correctly substitutes the '.' with the path of the MG5 distribution. So this will need some investigation, but it seems that it is just that it tries to compile the 'main' file from within the root path of Pythia8 and not its correct subdirectory.
I tried to compile by hand the main file generated by MGaMC but it crashes for various reasons (mainly some include files missing).
Anyway, this command doesn't seem to work in 2.3.4 either and I have never looked at its implementation before, so I cannot (don't want to) fix it now.
But I agree that it would make sense to have it fixed for this version.

>
> 2) The standard plot routines (MA4) does not work anymore:
> - I do not have any plot either at parton level
> - I do not have any plot for after the shower (even if the lhe file in
> order to do such plot is created)

I installed MA4 and pythia-pgs and I could successfully run the full chain but indeed I don't get any MA4 plots.
This must be related to some checks or return statement in the function 'create_plot' of the common_run_interface. Nothing big a priori.
Notice that when running the shower 'by hand' with the command 'shower run_01' in the madevent interactive interface, the plots are created.

> 3) if I type the function shower, I have as question:
> Which programs do you want to run?
> 0 / auto : running existing cards
> 1 / pythia : Pythia
> 2 / pgs : Pythia + PGS
> 3 / delphes : Pythia + Delphes.
> [0, 1, 2, 3, auto, pythia, pgs, delphes][60s to answer]
> This need to be updated to the new format.
> At the end of the run, the code ask me a second question:
> Which programs do you want to run?
> 0 / auto : running existing cards
> 1 / pythia8 : Pythia8
> 3 / delphes : Pythia8 + Delphes.
> [0, 1, 3, auto, pythia8, delphes][60s to answer]
> (This probably happens only if you have both PY6 and PY8 installed)

Well the idea there is that if the user doesn't specify which shower it wants, i.e. with

shower pythia8 run_01

or

shower pythia run_01

then it does all of the available ones. I guess it should rather ask which one the user wants, but this is most efficiently done with the tab completetion.
So if you don't like the current behavior then I think that forcing the use to specify the shower is the simplest.

>
> One general question (having those answer will allow me to review that part of
> the modification)
>
> 1) I have a bunch of question related to the CKKW-L support that you have
> added in MG:
> a) Where can...

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

Hi,

Here is some reply for the point who need them:
Thanks,

Olivier

> Well the idea there is that if the user doesn't specify which shower it wants, i.e. with
>
> shower pythia8 run_01
>
> or
>
> shower pythia run_01
>
> then it does all of the available ones. I guess it should rather ask which one the user wants, but this is most efficiently done with the tab completetion.
> So if you don't like the current behavior then I think that forcing the use to specify the shower is the simplest.

Clearly the current behavior is not satisfactory. Either having a question asking which one to run or force to specify is fine.
(or always choose PY8 is also fine) but like this no.

>> 1) I have a bunch of question related to the CKKW-L support that you have
>> added in MG:
>> a) Where can I find some documentation for how to run CKKW-L?
>
> On the pythia8 online manual:
> http://home.thep.lu.se/~torbjorn/pythia81html/Welcome.html
> (look for CKKW-L merging on the right hand side of the page)

We should create a launchpad FAQ and/or wiki page with minimal instruction (and refer to PY8)

> Again, please Stefan comment on that because I don't know much. The subtleties of the merging of decay products in CKKW-L are controlled by a combination of the two shower parameters ‘Merging:Process' and 'Merging:may_remove_decay_products'.

You need to have this clear since we need at least one of us knowing all the details of the MG side of the implementation.

> I agree that if the more general list support should be used for this as well, but it can be a bit tricky because you must make sure that corresponding fortran definition in run_card.inc is correctly written.

Indeed, but this is the same in Rik branch. It is important to use the same format. If you do not like the way Rik is writting this information it is then the perfect time to speak.

> On Mar 4, 2016, at 02:02, Valentin Hirschi <email address hidden> wrote:
>
>> Hi Valentin,
>>
>> Very nice branch. It's really cool all the interesting way the code is
>> improving those days.
>> I particularly like the change in the card edition part (maybe I did those but
>> I do not remember)
>
> Well it is OUR common branch, which underlies our work for the PY8-MG5aMC enhanced automated interface+merging at LO.
>
>> Here is my review:
>> First some functionalities which does not work on this branch
>>
>> 1) The output pythia8 does not work in this branch. This need to be fixed for
>> sure.
>> - You change the comment for the PY8 path in the configuration file, is
>> that related?
>
> I don't think so, because the information on screen shows that it correctly substitutes the '.' with the path of the MG5 distribution. So this will need some investigation, but it seems that it is just that it tries to compile the 'main' file from within the root path of Pythia8 and not its correct subdirectory.
> I tried to compile by hand the main file generated by MGaMC but it crashes for various reasons (mainly some include files missing).
> Anyway, this command doesn't seem to work in 2.3.4 either and I have never looked at its implementation bef...

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

Hi Valentin,

I tried:

./bin/mg5_aMC
generate p p > e+ ve ; add process e+ ve j ; output ; launch
shower=PYTHIA8

and it crashes when starting showering with "KeyError : 'showerkt'" . Indeed, the showerkt parameter is not in the run_card.dat, while line 3333 of the madevent_interface.py requires it.

Cheers,
Rik

review: Needs Fixing
365. By Valentin Hirschi

1. Added the possibility of passing any option to the HEPToolsInstallers via the command install in MG5.
2. Fixed two bugs in the PY8-MG5aMC interface. One related to the new label structure in Histograms.py and one because showerkt is not in the run_card. This will need to be fetched elsewhere.

366. By Olivier Mattelaer

improve API for matplotlib output

367. By Valentin Hirschi

1. Fixed normalization issue in our .lhe by writing a function enforce_lha_strategy in lhe_parser.py.
2. Fixed a couple issues in the merging and properly defined 'qWeed'.

368. By Valentin Hirschi

1. Use a different lhe file for the enforcement of the lha_strategy -4.

369. By Valentin Hirschi

1. Fixed an issue with ptlund merging.

370. By Olivier Mattelaer

allow to generate event with event normalise to the average

371. By Olivier Mattelaer

update html for PY8 without matching

372. By Olivier Mattelaer

just make a warning for Syscalc but let him run (so far)

373. By Valentin Hirschi

1. Improved the MGPY8 interface by allowing to specify HEPMC output and
   also checking if PY8 crash.
2. Adding the pt observable to compare merging schemes whose DJR definition
   don't match.

374. By Valentin Hirschi

1. Revert the advanced_install hack to install local copies.
2. Added a Pythia8 option:
     HEPMCoutput:file
   Which can be set to /dev/null to avoid produce an lhe.

375. By Valentin Hirschi

1. Added the completion for the option specifying the path of the pythia8 or mg5amc tarball.

376. By Stefan Prestel

Fixed merging cut so that states with one massive particle are correctly handled. Also, incorrect do_cuts replaced by more suitable from_decay

377. By Stefan Prestel

Merged with latest revision, after updating merging cut.

378. By Valentin Hirschi

1. Added the missing option 'madanalysis5_path' in common_run_interface.py
2. Reinstated the warning about SysCalc not supporting the 'average' lhe convention.

379. By Stefan Prestel

Changed ktdurham to ensure that no ktdurham cut is applied to states with a no massless outgoing partons at all

380. By Valentin Hirschi

1. commented hack for local HEPToolsInstaller

381. By Valentin Hirschi

1. Added the completion for the new option '--no_root_in_MA5' for the advanced install function of MA5 (which vetoes the use of ROOT in MA5)

382. By Valentin Hirschi

1. Temporary disabling the generation of the MA5 hadron-level card since MA5 is broken as of now :(.
2. Added the central value to be part of the merging scale variations when those are automatically set by MG5aMC.

383. By Valentin Hirschi

1. Fixed an issue when setting the pythia8_path option in set_configuration.
2. Change all path settings in advanced_install to be absolute.
3. Remove the hack to pick a specific MG5 server in do_install().

384. By Valentin Hirschi

1. Insured that the central merging scale is added to the list of variations, unless the user directly specified this list in the PY8 card with the option 'SysCalc:qCutList' for MLM or 'SysCalc:tmsList' for CKKWL.

385. By Olivier Mattelaer

merge with 2.5.0

386. By Olivier Mattelaer

fix the output pythia8 command to make it compatible with the version of py8 installed via install PY8

387. By Olivier Mattelaer

fix the display of the options to put hidden the retro-compatible option like pythia

388. By Valentin Hirschi

1. First round of my fixes.

389. By Olivier Mattelaer

put back more decent printout for the refs

390. By Valentin Hirschi

1. Restructured the card edition

391. By Valentin Hirschi

1. Fixed typo

392. By Valentin Hirschi

1. Cleaned up the way Pythia8 cross-sections are stored.

393. By Valentin Hirschi

1. Added '-lstdc++' or '-lc++' to the MCatNLO compilation for Pythia8 if (and only if)
   these were specified when compiling Pythia8.
2. Fixed the specification of the _cpp_dependencies to HEPToolsInstaller when the user uses
   clang and didn't specify his compiler in the MG5 options.

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

This branch is now out of date. So I close the merge request.
As far as I know Valentin (or I) implemented all the comment made in this review.
The code obviously re-need a full review.

review: Disapprove

Unmerged revisions

393. By Valentin Hirschi

1. Added '-lstdc++' or '-lc++' to the MCatNLO compilation for Pythia8 if (and only if)
   these were specified when compiling Pythia8.
2. Fixed the specification of the _cpp_dependencies to HEPToolsInstaller when the user uses
   clang and didn't specify his compiler in the MG5 options.

392. By Valentin Hirschi

1. Cleaned up the way Pythia8 cross-sections are stored.

391. By Valentin Hirschi

1. Fixed typo

390. By Valentin Hirschi

1. Restructured the card edition

389. By Olivier Mattelaer

put back more decent printout for the refs

388. By Valentin Hirschi

1. First round of my fixes.

387. By Olivier Mattelaer

fix the display of the options to put hidden the retro-compatible option like pythia

386. By Olivier Mattelaer

fix the output pythia8 command to make it compatible with the version of py8 installed via install PY8

385. By Olivier Mattelaer

merge with 2.5.0

384. By Valentin Hirschi

1. Insured that the central merging scale is added to the list of variations, unless the user directly specified this list in the PY8 card with the option 'SysCalc:qCutList' for MLM or 'SysCalc:tmsList' for CKKWL.

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

Subscribers

People subscribed via source and target branches

to all changes: