diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e3e92d..f5fbe9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,315 +1,315 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) set(CMAKE_LEGACY_CYGWIN_WIN32 0) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -project("HEJ" VERSION 2.1.0 LANGUAGES C CXX) +project("HEJ" VERSION 2.2.0 LANGUAGES C CXX) ## User settings include(CMakeDependentOption) option(EXCLUDE_QCDloop "Do not include QCDloop" FALSE) option(EXCLUDE_HighFive "Do not include HighFive" FALSE) option(EXCLUDE_HepMC "Do not include HepMC version 2" FALSE) option(EXCLUDE_HepMC3 "Do not include HepMC version 3" FALSE) option(EXCLUDE_ROOT "Do not include ROOT" TRUE) # Only skip rivet if we both HepMC 2 & 3 are excluded, since we don't know which # HepMC version rivet needs CMAKE_DEPENDENT_OPTION(EXCLUDE_rivet "Do not include rivet" FALSE "NOT EXCLUDE_HepMC OR NOT EXCLUDE_HepMC3" TRUE) option(BUILD_EXAMPLES "Build examples" FALSE) option(TEST_ALL "Run additional (longer) tests" FALSE) option(TEST_COVERAGE "Generate test coverage with \"gcovr\"" FALSE) option(RUN_CLANG_TIDY "Run clang tidy" FALSE) option(WITH_CCACHE "Build with ccache" FALSE) # Set a default build type if none was specified set(default_build_type "RelWithDebInfo") if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to '${default_build_type}' as none was specified.") set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() ## Global flags for the compiler (all warnings) if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") elseif (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /EHsc") endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 17) ## enable ccache if(WITH_CCACHE) find_program(CCACHE_FOUND ccache) if(NOT CCACHE_FOUND) message(FATAL_ERROR "ccache not found, but requested. Please deactivate WITH_CCACHE") endif() set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND}) endif() ## Check if this is a git folder find_package(Git QUIET) if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") set(_is_git TRUE) endif() ## download FORM submodule # from https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html if(_is_git) option(GIT_SUBMODULE "Check submodules during build" ON) if(GIT_SUBMODULE AND NOT EXISTS "${PROJECT_SOURCE_DIR}/current_generator/form/Makefile.am") message(STATUS "Submodule update") execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE GIT_SUBMOD_RESULT) if(NOT GIT_SUBMOD_RESULT EQUAL "0") message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") endif() endif() endif() if(NOT EXISTS "${PROJECT_SOURCE_DIR}/current_generator/form/Makefile.am") message(FATAL_ERROR "FORM was not downloaded! Please update git-submodules and try again.") endif() ## Create Version set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Get the latest abbreviated commit hash of the working branch if(_is_git) execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE PROJECT_GIT_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE ) # Get the current working branch execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE PROJECT_GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ) else() set(PROJECT_GIT_REVISION "UNKNOWN") set(PROJECT_GIT_BRANCH "UNKNOWN") endif() ## target directories for install set(INSTALL_INCLUDE_DIR_BASE include) set(INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR_BASE}/HEJ) set(INSTALL_BIN_DIR bin) set(INSTALL_LIB_DIR lib) set(INSTALL_CONFIG_DIR lib/cmake/HEJ) ## find dependencies find_package(CLHEP 2.3 REQUIRED) find_package(fastjet REQUIRED) find_package(LHAPDF 6 REQUIRED) ## Amend unintuitive behaviour of FindBoost.cmake ## Priority of BOOST_ROOT over BOOSTROOT matches FindBoost.cmake ## at least for cmake 3.12 if(DEFINED BOOST_ROOT) message("BOOST_ROOT set - only looking for Boost in ${BOOST_ROOT}") set(Boost_NO_BOOST_CMAKE ON) elseif(DEFINED BOOSTROOT) message("BOOSTROOT set - only looking for Boost in ${BOOSTROOT}") set(Boost_NO_BOOST_CMAKE ON) endif() find_package(Boost REQUIRED COMPONENTS iostreams) find_package(yaml-cpp) # requiring yaml does not work with fedora if(EXCLUDE_HepMC) message(STATUS "Skipping HepMC") else() find_package(HepMC 2 EXACT) endif() if(EXCLUDE_HepMC3) message(STATUS "Skipping HepMC3") else() ## version 3.1: Finding version not possible in 3.1.1, see HepMC3 git 29e7a6c3 find_package(HepMC3 QUIET) # suppress CMake warning if HepMC3 not available ## print standard message find_package_handle_standard_args( HepMC3 FOUND_VAR HepMC3_FOUND REQUIRED_VARS HEPMC3_INCLUDE_DIR HEPMC3_LIBRARIES # VERSION_VAR # HEPMC3_VERSION ) endif() if(EXCLUDE_rivet) message(STATUS "Skipping rivet") else() find_package(rivet) if(rivet_FOUND) if(rivet_USE_HEPMC3 AND NOT HepMC3_FOUND) message(FATAL_ERROR "Rivet was compiled with HepMC version 3, " "but HepMC3 was not found!") elseif(NOT rivet_USE_HEPMC3 AND NOT HepMC_FOUND) message(FATAL_ERROR "Rivet was compiled with HepMC version 2, " "but HepMC2 was not found!") endif() endif() endif() if(EXCLUDE_QCDloop) message(STATUS "Skipping QCDloop") else() find_package(QCDloop 2) endif() if(NOT EXCLUDE_ROOT) # Don't print "Skipping ROOT" for default option (EXCLUDE_ROOT=TRUE) find_package(ROOT 6.14) # root targets are broken before 6.14 find_package_handle_standard_args( ROOT FOUND_VAR ROOT_FOUND REQUIRED_VARS ROOT_INCLUDE_DIRS ROOT_LIBRARIES VERSION_VAR ROOT_VERSION ) endif() if(EXCLUDE_HighFive) message(STATUS "Skipping HighFive") else() find_package(HighFive QUIET) find_package_handle_standard_args( HighFive CONFIG_MODE ) endif() include(RepairTargets) # more reliable cmake targets ## Save dependencies for templates set(HEJ_BUILD_WITH_HepMC2 ${HepMC_FOUND}) set(HEJ_BUILD_WITH_HepMC3 ${HepMC3_FOUND}) set(HEJ_BUILD_WITH_RIVET ${rivet_FOUND}) if(rivet_FOUND AND rivet_VERSION VERSION_LESS 3) set(HEJ_USE_RIVET2 TRUE) endif() set(HEJ_BUILD_WITH_QCDLOOP ${QCDloop_FOUND}) set(HEJ_BUILD_WITH_HDF5 ${HighFive_FOUND}) ## Template files configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/Version.hh.in include/HEJ/Version.hh @ONLY ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/ConfigFlags.hh.in include/HEJ/ConfigFlags.hh @ONLY ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/HEJ-config.cc.in src/bin/HEJ-config.cc @ONLY ) # Generate CMake config file include(CMakePackageConfigHelpers) configure_package_config_file( cmake/Templates/hej-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config.cmake INSTALL_DESTINATION ${INSTALL_CONFIG_DIR} PATH_VARS INSTALL_INCLUDE_DIR_BASE INSTALL_LIB_DIR ) write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config-version.cmake COMPATIBILITY SameMajorVersion ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/${INSTALL_CONFIG_DIR}/hej-config-version.cmake DESTINATION ${INSTALL_CONFIG_DIR}) ## shortcut for HEJ specific includes set(HEJ_INCLUDE_DIR $ $ $ ) # Add test coverage if (TEST_COVERAGE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) ) include(CodeCoverage) APPEND_COVERAGE_COMPILER_FLAGS() set(COVERAGE_GCOVR_EXCLUDES "${PROJECT_SOURCE_DIR}/include/LHEF/*" "${PROJECT_SOURCE_DIR}/include/cxxopts.hpp" "${PROJECT_SOURCE_DIR}/t/*" "${PROJECT_BINARY_DIR}/*") SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML( NAME ctest_coverage EXECUTABLE ctest ) endif() add_subdirectory(current_generator) ## create main HEJ library add_subdirectory(src) ## define executable add_executable(HEJ_main src/bin/HEJ.cc) set_target_properties(HEJ_main PROPERTIES OUTPUT_NAME "HEJ") ## link libraries target_link_libraries(HEJ_main HEJ) add_executable(HEJ-config src/bin/HEJ-config.cc) target_include_directories(HEJ-config PRIVATE ${HEJ_INCLUDE_DIR}) file(GLOB hej_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/HEJ/*.hh ${PROJECT_BINARY_DIR}/include/HEJ/*.hh ) file(GLOB hej_detail_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/HEJ/detail/*.hh) file(GLOB lhef_headers ${CMAKE_CURRENT_SOURCE_DIR}/include/LHEF/*.h) install(FILES ${hej_headers} DESTINATION ${INSTALL_INCLUDE_DIR}) install(FILES ${hej_detail_headers} DESTINATION ${INSTALL_INCLUDE_DIR}/detail/) install(FILES ${lhef_headers} DESTINATION ${INSTALL_INCLUDE_DIR_BASE}/LHEF/) install(TARGETS HEJ_main HEJ-config DESTINATION ${INSTALL_BIN_DIR}) ## tests (prevent testing if current project is a subproject) if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) ## advanced version of enable_testing() ## adds "BUILD_TESTING" option to deactivate testing include(CTest) if(BUILD_TESTING) set(BUILD_EXAMPLES TRUE) # examples needed for testing set(include_tests TRUE) endif() endif() ## build examples if(BUILD_EXAMPLES) message(STATUS "Adding examples") add_subdirectory(examples) endif() ## build tests if(include_tests) message(STATUS "Adding tests") add_subdirectory(t) endif() add_subdirectory(doc) ## Clang-tidy if(RUN_CLANG_TIDY) find_program( CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" ) if(NOT CLANG_TIDY_EXE) message(FATAL_ERROR "clang-tidy not found, but requested. Please deactivate RUN_CLANG_TIDY" ) else() set_target_properties( HEJ PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-header-filter=${CMAKE_SOURCE_DIR}/include/HEJ;-fix;--fix-errors" ) endif() endif() diff --git a/FixedOrderGen/CMakeLists.txt b/FixedOrderGen/CMakeLists.txt index d9f69c3..8a9c296 100644 --- a/FixedOrderGen/CMakeLists.txt +++ b/FixedOrderGen/CMakeLists.txt @@ -1,116 +1,116 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) set(CMAKE_LEGACY_CYGWIN_WIN32 0) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -project("HEJ Fixed Order Generation" VERSION 2.1.0 LANGUAGES C CXX) +project("HEJ Fixed Order Generation" VERSION 2.2.0 LANGUAGES C CXX) ## User settings include(CMakeDependentOption) option(TEST_ALL "Run additional (longer) tests" FALSE) option(RUN_CLANG_TIDY "Run clang tidy" FALSE) option(TEST_COVERAGE "Generate test coverage with \"gcovr\"" FALSE) option(WITH_CCACHE "Build with ccache" FALSE) # Set a default build type if none was specified set(default_build_type "RelWithDebInfo") if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to '${default_build_type}' as none was specified.") set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) # Set the possible values of build type for cmake-gui set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") endif() ## Global flags for the compiler (all warnings) if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") elseif (MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /EHsc") endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 17) ## enable ccache if(WITH_CCACHE) find_program(CCACHE_FOUND ccache) if(NOT CCACHE_FOUND) message(FATAL_ERROR "ccache not found, but requested. Please deactivate WITH_CCACHE") endif() set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND}) endif() ## Create Version set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") # Get the latest abbreviated commit hash of the working branch execute_process( COMMAND git rev-parse HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE PROJECT_GIT_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE ) # Get the current working branch execute_process( COMMAND git rev-parse --abbrev-ref HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} OUTPUT_VARIABLE PROJECT_GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/Version.hh.in include/Version.hh @ONLY ) ## Use cmake modules from HEJ src set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake/Modules/") ## Find HEJ (only dependency) ## HEJ includes all sub dependencies (fastjet, lhapdf, ...) find_package(HEJ 2 REQUIRED) include(RepairTargets) # more reliable cmake targets # Add test coverage if (TEST_COVERAGE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) ) include(CodeCoverage) APPEND_COVERAGE_COMPILER_FLAGS() set(COVERAGE_GCOVR_EXCLUDES "${PROJECT_SOURCE_DIR}/t/*" "${PROJECT_BINARY_DIR}/*") SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML( NAME ctest_coverage EXECUTABLE ctest ) endif() ## define executable add_subdirectory(src) add_executable(HEJFOG src/bin/main.cc) target_link_libraries(HEJFOG hejfog_lib) install(TARGETS HEJFOG DESTINATION bin) ## tests include(CTest) ## advanced version of enable_testing() ## adds "BUILD_TESTING" option to deactivate testing if(BUILD_TESTING) add_subdirectory(t) endif() ## Clang-tidy if(RUN_CLANG_TIDY) find_program( CLANG_TIDY_EXE NAMES "clang-tidy" DOC "Path to clang-tidy executable" ) if(NOT CLANG_TIDY_EXE) message(FATAL_ERROR "clang-tidy not found, but requested. Please deactivate RUN_CLANG_TIDY" ) else() set_target_properties( hejfog_lib PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};-header-filter=${CMAKE_SOURCE_DIR}/include;-fix;--fix-errors" ) endif() endif() diff --git a/doc/doxygen/mainpage.dox b/doc/doxygen/mainpage.dox index ebb0177..9eaa0ad 100644 --- a/doc/doxygen/mainpage.dox +++ b/doc/doxygen/mainpage.dox @@ -1,225 +1,225 @@ namespace HEJ { // so that doxygen links names in this namespace /** * @mainpage * * @section intro Introduction * * HEJ 2 is a library for all-order resummation of high-energy * logarithms. It includes a program to add resummation to fixed-order * events. User documentation for the program can be found here. This + * href="https://https://hej.hepforge.org/doc/2.2/user/">here. This * documentation is instead aimed at users of the library itself. * * @section overview Overview * * The main functionality is contained in the HEJ namespace. Particles are * defined via the Particle struct, which consists of the particle * four-momentum, its identifier according to the * PDG Monte Carlo numbering scheme and an optional Colour charge. Given a * number of incoming and outgoing particles, the square of the resummation * matrix element can be calculated with the help of the MatrixElement class. * * The EventReweighter class adds resummation to existing fixed-order * events. Both fixed-order and resummation events are objects of the * Event class, which are created from EventData objects with the * help of a jet * definition according to the fastjet library. EventData * objects can be assembled manually or converted from input events in * the LesHouches standard, read from file with a EventReader (e.g. * LesHouchesReader or HDF5Reader). * * Events can be saved with one of the EventWriter classes. Currently, * there is support for the Les Houches event file format with the * LesHouchesWriter class. If HEJ 2 was installed with HepMC 2 or 3 * support, the respective format is available through the HepMC2Writer * or HepMC3Writer class. The HDF5Writer class can be used if HEJ 2 was * compiled with HDF5 support. * * Further classes of interest are the interfaces to the Mixmax and * Ranlux64 random number generators, the PDF class to interact with LHAPDF and the ScaleGenerator * and ScaleConfig classes to calculate renormalisation and factorisation * scales for a given Event. * * @section example Example * * As an example, we show a toy program that computes the square of a * matrix element in the HEJ approximation for a single event. First, we * include the necessary header files: * @code{.cpp} * #include "HEJ/Event.hh" * #include "HEJ/MatrixElement.hh" * @endcode * We then specify the incoming and outgoing particles. A particle * has a type, a four-momentum \f$(p_x, p_y, p_z, E)\f$ and optionally a colour * charge. For instance, an incoming gluon could be defined as * @code{.cpp} * fastjet::PseudoJet momentum{0, 0, 308., 308.}; * HEJ::Colour colours{501,502}; * HEJ::Particle gluon_in{HEJ::ParticleID::gluon, momentum, colours}; * @endcode * We collect all incoming and outgoing particles in a partonic event. Here * is an example for a partonic \f$gu \to gghu\f$ event (omitting colours): * @code{.cpp} * HEJ::Event::EventData partonic_event; * * // incoming particles * partonic_event.incoming[0] = { * HEJ::ParticleID::gluon, * { 0., 0., 308., 308.} * }; * partonic_event.incoming[1] = { * HEJ::ParticleID::up, * { 0., 0.,-164., 164.} * }; * // outgoing particles * partonic_event.outgoing.push_back({ * HEJ::ParticleID::higgs, * { 98., 82., 14., 180.} * }); * partonic_event.outgoing.push_back({ * HEJ::ParticleID::up, * { 68.,-54., 36., 94.} * }); * partonic_event.outgoing.push_back({ * HEJ::ParticleID::gluon, * {-72., 9., 48., 87.} * }); * partonic_event.outgoing.push_back({ * HEJ::ParticleID::gluon, * {-94.,-37., 46., 111.} * }); * @endcode * Alternatively, we could read the event from e.g. a Les Houches event file, * possibly compressed with gzip. For this, the additional header file * @c HEJ/EventReader.hh have to be included. * @code{.cpp} * auto reader = HEJ::make_reader("events.lhe.gz"); * reader->read_event(); * HEJ::Event::EventData partonic_event{reader->hepeup()}; * @endcode * * In this specific example we will later choose a constant value for the * strong coupling, so that the HEJ matrix element does not depend on the * renormalisation scale. However, in a more general scenario, we will want * to set a central scale: * @code{.cpp} * partonic_event.parameters.central.mur = 50.; * @endcode * It is possible to add more scales in order to perform scale variation: * @code{.cpp} * partonic_event.parameters.variations.resize(2); * partonic_event.parameters.variations[0].mur = 25.; * partonic_event.parameters.variations[1].mur = 100.; * @endcode * * In the next step, we leverage FastJet to construct an event with * clustered jets. Here, we use antikt jets with R=0.4 and transverse * momenta of at least 30 GeV. * @code{.cpp} * const fastjet::JetDefinition jet_def{ * fastjet::JetAlgorithm::antikt_algorithm, 0.4 * }; * const double min_jet_pt = 30.; * HEJ::Event event{partonic_event.cluster(jet_def, min_jet_pt)}; * @endcode * In order to calculate the Matrix element, we now have to fix the physics * parameters. For the sake of simplicity, we assume an effective coupling * of the Higgs boson to gluons in the limit of an infinite top-quark mass * and a fixed value of \f$\alpha_s = 0.118\f$ for the strong coupling. * @code{.cpp} * const auto alpha_s = [](double /* mu_r */) { return 0.118; }; * HEJ::MatrixElementConfig ME_config; * // whether to include corrections from the * // evolution of \alpha_s in virtual corrections * ME_config.log_correction = false; * HEJ::MatrixElement ME{alpha_s, ME_config}; * @endcode * If QCDLoop is installed, we can also take into account the full loop * effects with finite top and bottom quark masses: * @code{.cpp} * HEJ::MatrixElementConfig ME_config; * ME_config.Higgs_coupling.use_impact_factors = false; * ME_config.Higgs_coupling.mt = 163; * ME_config.Higgs_coupling.include_bottom = true; * ME_config.Higgs_coupling.mb = 2.8; * @endcode * Finally, we can compute and print the square of the matrix element with * @code{.cpp} * std::cout << "HEJ ME: " << ME(event).central << '\n'; * @endcode * In the case of scale variation, the weight associated with the scale * @c event.variations[i].mur is @c ME(event).variations[i]. * * Collecting the above pieces, we have the following program: * @code{.cpp} * #include "HEJ/Event.hh" * #include "HEJ/MatrixElement.hh" * * int main(){ * HEJ::Event::EventData partonic_event; * // incoming particles * partonic_event.incoming[0] = { * HEJ::ParticleID::gluon, * { 0., 0., 308., 308.} * }; * partonic_event.incoming[1] = { * HEJ::ParticleID::up, * { 0., 0.,-164., 164.} * }; * // outgoing particles * partonic_event.outgoing.push_back({ * HEJ::ParticleID::higgs, * { 98., 82., 14., 180.} * }); * partonic_event.outgoing.push_back({ * HEJ::ParticleID::up, * { 68.,-54., 36., 94.} * }); * partonic_event.outgoing.push_back({ * HEJ::ParticleID::gluon, * {-72., 9., 48., 87.} * }); * partonic_event.outgoing.push_back({ * HEJ::ParticleID::gluon, * {-94.,-37., 46., 111.} * }); * * const fastjet::JetDefinition jet_def{ * fastjet::JetAlgorithm::antikt_algorithm, 0.4 * }; * const double min_jet_pt = 30.; * HEJ::Event event{partonic_event.cluster(jet_def, min_jet_pt)}; * const auto alpha_s = [](double /* mu_r */) { return 0.118; }; * HEJ::MatrixElementConfig ME_config; * // whether to include corrections from the * // evolution of \alpha_s in virtual corrections * ME_config.log_correction = false; * HEJ::MatrixElement ME{alpha_s, ME_config}; * * std::cout * << "HEJ ME: " << ME(event).central * << " = tree * virtual = " << ME.tree(event).central * << " * " << ME.virtual_corrections(event).central * << '\n'; * } * @endcode * After saving the above code to a file @c matrix_element.cc, it * can be compiled into an executable @c matrix_element with a * suitable compiler. For example, with @c g++ this can be done * with the command * @code{.sh} * g++ -o matrix_element matrix_element.cc -lHEJ -lfastjet * @endcode * If HEJ or any of the required libraries was installed to a * non-standard location, it may be necessary to explicitly specify the * paths to the required header and library files. This can be done with * the @c HEJ-config executable and similar programs for the * other dependencies: * @code{.sh} * g++ $(fastjet-config --cxxflags) $(HEJ-config --cxxflags) -o matrix_element matrix_element.cc $(HEJ-config --libs) $(fastjet-config --libs) * @endcode */ } diff --git a/doc/sphinx/installation.rst b/doc/sphinx/installation.rst index bd036c5..5b9b482 100644 --- a/doc/sphinx/installation.rst +++ b/doc/sphinx/installation.rst @@ -1,128 +1,128 @@ .. _Installation: Installation ============ Download -------- A tar archive of the HEJ 2 source code can be downloaded and decompressed with the command:: - curl https://hej.hepforge.org/downloads?f=HEJ_2.1.tar.gz | tar -xz + curl https://hej.hepforge.org/downloads?f=HEJ_2.2.tar.gz | tar -xz -To obtain the latest stable HEJ version, `HEJ_2.1.tar.gz` should be +To obtain the latest stable HEJ version, `HEJ_2.2.tar.gz` should be replaced by `HEJ.tar.gz`. Alternatively, the HEJ source code can be obtained by installing the `git version control system `_. and running: .. code-block:: sh git clone https://phab.hepforge.org/source/hej.git We also provide a `Docker image `_ containing a HEJ 2 installation. This image can be pulled with:: docker pull hejdock/hej When using the Docker image the remaining installation steps can be skipped. Prerequisites ------------- Before installing HEJ 2, you need the following programs and libraries: - `CMake `_ version 3.1 - A compiler supporting the C++17 standard, for example `gcc `_ 7 or later - `FastJet `_ - `CLHEP `_ version 2.3 - `LHAPDF `_ version 6 - The `IOStreams` and `uBLAS` `boost `_ libraries - `yaml-cpp `_ - `autoconf` and `automake` for `FORM `_ In addition, some optional features have additional dependencies: - `Version 2 of QCDLoop `_ is required to include finite top mass corrections in Higgs boson + jets production. - `HepMC versions 2 and 3 `_ enable event output in the respective format. - `Rivet `_ version 3.1.4 or later together with HepMC 2 or 3 allow using Rivet analyses. - `HighFive `_ has to be installed in order to read and write event files in the `HDF5 `_-based format suggested in `arXiv:1905.05120 `_. We strongly recommend to install these programs and libraries to standard locations: - The executable files should be inside one of the directories listed in the `PATH` environment variable. This concerns `cmake`, the C++ compiler, and the executables contained in `autoconf` and `automake`. - The library header files ending with `.h`, `.hh`, or `.hpp` should be in a directory where they are found by the C++ compiler. For `gcc` or `clang`, custom locations can be specified using the `CPLUS_INCLUDE_PATH` environment variable. - The compiled library files ending with `.a`, `.so`, or `.dylib` should be in a directory where they are found by the linker. Custom locations can be set via the `LIBRARY_PATH` environment variable. For shared object libraries (`.so` or `.dylib`) custom locations should also be part of `LD_LIBRARY_PATH` on linux and `DYLD_FALLBACK_LIBRARY_PATH` or `DYLD_LIBRARY_PATH` on macOS. Compilation ----------- To compile and install HEJ 2 run:: cmake source/directory -DCMAKE_INSTALL_PREFIX=target/directory make install :file:`source/directory` is the directory containing the file :file:`CMakeLists.txt`. If you omit :code:`-DCMAKE_INSTALL_PREFIX=target/directory` HEJ 2 will be installed to some default location. In case some of the aforementioned prerequisites are not found by :code:`cmake` you can give a hint by adding an additional argument :code:`-Dlibname_ROOT_DIR=/directory/with/library`, where :code:`libname` should be replaced by the name of the library in question. For example, if `FastJet` is installed in the subdirectory `.local` of your home directory with the `libfastjet.*` library files in `.local/lib` and the header files ending with `.hh` in `.local/include/fastjet` you can pass :code:`-Dfastjet_ROOT_DIR=$HOME/.local` to `cmake`. If :code:`cmake` fails to find (the correct) boost path, try setting :code:`-DBOOST_ROOT=/path/to/boost`, this will force :code:`cmake` to search for boost only in :code:`/path/to/boost`. To not include specific packages one can add :code:`-DEXCLUDE_packagename=TRUE` to :code:`cmake`, e.g. by setting :code:`-DEXCLUDE_rivet=TRUE` HEJ 2 will not be interfaced to Rivet even if it is available on the system. Testing ------- To test your installation, download the NNPDF 2.3 PDF set with:: lhapdf install NNPDF23_nlo_as_0119 and run:: make test The test data of HEJ are stored in a `Git Large File Storage `_ format. :code:`git clone` therefore requires :code:`git-lfs` to download the data correctly.