Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F9501682
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
42 KB
Subscribers
None
View Options
diff --git a/Changes-API.md b/Changes-API.md
index 0e88e49..d96807a 100644
--- a/Changes-API.md
+++ b/Changes-API.md
@@ -1,93 +1,94 @@
# Changelog for HEJ API
This log lists only changes on the HEJ API. These are primarily code changes
relevant for calling HEJ as an API. This file should only be read as an addition
to [`Changes.md`](Changes.md), where the main features are documented.
## Version 2.1
### 2.1.0
#### Changes to Event class
* Restructured `Event` class
- `Event` can now only be build from a (new) `Event::EventData` class
- Removed default constructor for `Event`
- `Event::EventData` replaces the old `UnclusteredEvent` struct.
- `UnclusteredEvent` is now deprecated, and will be removed in HEJ Version
2.3.0
- Removed `Event.unclustered()` function
- Added new member function `Events.parameters()`, to directly access
(underlying) `Parameters<EventParameters>`
- New member functions `begin_partons`, `end_partons` (`rbegin_partons`,
`rend_partons`) with aliases `cbegin_partons`, `cend_partons`
(`crbegin_partons`, `crend_partons`) for constant (reversed) iterators over
outgoing partons.
* New function `Event::EventData.reconstruct_intermediate()` to reconstruct
bosons from decays, e.g. `positron + nu_e => Wp`
* Added optional Colour charges to particles (`Particle.colour`)
- Colour connection in the HEJ limit can be generated via
`Event.generate_colours` (automatically done in the resummation)
- Colour configuration of input events can be checked with
`Event.is_leading_colour`
* Added function `Event.valid_hej_state` to check if event _could have_ been
produced by `HEJ` according to the `max ext soft pt fraction` cut on the jets
#### Updated functions
* Renamed `EventType::nonHEJ` to `EventType::non_resummable` and `is_HEJ()`
to `is_resummable()` such that run card is consistent with internal workings
* Made `MatrixElement.tree_kin(...)` and `MatrixElement.tree_param(...)` public
* New `EventReweighter` member function `treatment` to query the
treatment with respect to resummation for the various event types.
* Added auxiliary functions to obtain a `std::string` from and
`EventDescription` (`to_string` for human readable, and `to_simple_string`
for easy parsable string)
#### New classes
* New class `Unweighter` to do unweighting
* New class `CrossSectionAccumulator` to keep track of Cross Section of the
different subprocess
* New template struct `Parameters` similar to old `Weights`
- `Weights` are now an alias for `Parameters<double>`. Calling `Weights` did
not change
- `Weights.hh` was replaced by `Parameters.hh`. The old `Weights.hh` header
will be removed in HEJ Version 2.2.0
* Function to multiplication and division of `EventParameters.weight` by double
- This can be combined with `Parameters`, e.g.
`Parameters<EventParameters>*Weights`, see also `Events.parameters()`
- Moved `EventParameters` to `Parameters.hh` header
* new class `EWConstants` replaces previously hard coded `vev`
- `EWConstants` have to be set in the general `Config` and the
`MatrixElementConfig`
#### Input/Output
* New abstract `EventReader` class, as base for reading events from files
- Moved LHE file reader to `HEJ::LesHouchesReader`
* Support reading (`HDF5Reader`) and writing (`HDF5Writer`) `hdf5` files
* New `BufferedEventReader` class that allows to put events back into
the reader.
+* New `SherpaLHEReader` to read Sherpa LHE files with correct weights
* `get_analysis` now requires `YAML::Node` and `LHEF::HEPRUP` as arguments
* Replaced `HepMCInterface` and `HepMCWriter` by `HepMCInterfaceX` and
`HepMCWriterX` respectively, with `X` being the major version of HepMC (2 or
3)
- Renamed `HepMCInterfaceX::init_kinematics` to `HepMCInterfaceX::init_event`
and protected it, use `HepMCInterfaceX::operator()` instead
- Removed redundant `HepMCInterfaceX::add_variation` function
#### Linking
* Export cmake target `HEJ::HEJ` to link directly against `libHEJ`
#### Miscellaneous
* Capitalisation of `Config.hh` now matches class `Config` (was `config.hh`)
* Replaced redundant member `EventReweighterConfig::jet_param` getter function
`EventReweighter.jet_param()` (`JetParameters` are already in
`PhaseSpacePointConfig`)
## Version 2.0
### 2.0.4
* Fixed wrong path of `HEJ_INCLUDE_DIR` in `hej-config.cmake`
### 2.0.0
* First release
diff --git a/Changes.md b/Changes.md
index 00f8bee..9d3742c 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,122 +1,124 @@
# Changelog
This is the log for changes to the HEJ program. Further changes to the HEJ API
are documented in [`Changes-API.md`](Changes-API.md). If you are using HEJ as a
library, please also read the changes there.
## Version 2.1
Implemented W boson with jets for complete set of first subleading processes
(unordered gluon, central and extremal quark-antiquark pair), see
[arXiv:TODO](https://arxiv.org/abs/TODO). Ported unordered gluon emissions for
pure jets from HEJ 1. This release include many changes to the code, which
affect users of HEJ as a library (see [`Changes-API.md`](Changes-API.md)).
### 2.1.0
#### New Processes
* Resummation for W bosons with jets
- New subleading processes `extremal qqx` & `central qqx` for a quark and
anti-quark in the final state, e.g. `g g => u d_bar Wm g` (the other
subleading processes also work with W's)
- `HEJFOG` can generate multiple jets together with a (off-shell) W bosons
decaying into lepton & neutrino
* Resummation can now be performed on all subleading processes within pure
jets also. This includes `unordered`, `extremal qqbar` and `central
qqbar` processes.
#### More Physics implementation
* Partons now have a Colour charge
- Colours are read from and written to LHE files
- For reweighted events the colours are created according to leading colour in
the FKL limit
* Use relative fraction for soft transverse momentum in extremal jets (`max ext
soft pt fraction`). This supersedes `min extparton pt`, which is now
deprecated and will be removed in future versions.
#### Updates to Runcard
* Allow multiplication and division of multiple scale functions e.g.
`H_T/2*m_j1j2`
* Grouped `event treatment` for subleading channels together in runcard
- Rename `non-HEJ` processes to `non-resummable`
* Read electro-weak constants from input
- new mandatory setting `vev` to change vacuum expectation value
- new mandatory settings `particle properties` to specify mass & width of
bosons
- FOG: decays are now specified in `decays` setting (previously under
`particle properties`)
* Optional setting to specify maximal number of Fixed Order events (`max
events`, default is all)
* Allow changing the regulator lambda in input (`regulator parameter`, only for
advanced users)
#### Changes to Input/Output
* Added support to read & write `hdf5` event files suggested in
[arXiv:1905.05120](https://arxiv.org/abs/1905.05120) (needs
[HighFive](https://github.com/BlueBrain/HighFive))
* Support input with average weight equal to the cross section (`IDWTUP=1 or 4`)
+* Support unmodified Les Houches Event Files written by Sherpa with
+ `cross section = sum(weights)/sum(trials)`
* Analyses now get general run information (`LHEF::HEPRUP`) in the
constructor. **This might break previously written, external analyses!**
- external analyses should now be created with
`make_analysis(YAML::Node const & config, LHEF::HEPRUP const & heprup)`
* Support `rivet` version 3 with both `HepMC` version 2 and 3
- Multiple weights with `rivet 3` will only create one `.yoda` file (instead
of one per weight/scale)
* Added option to unweight only resummation events
(`unweight: {type: resummation}`)
* Added option for partially unweighting resummation events, similar to
the fixed-order generator.
* Improved unweighting algorithm.
* Follow HepMC convention for particle Status codes: incoming = 11,
decaying = 2, outgoing = 1 (unchanged)
#### Miscellaneous
* Print cross sections at end of run
* Added example analysis & scale to `examples/`. Everything in `examples/` will
be build when the flag `-DBUILD_EXAMPLES=TRUE` is set in `cmake`.
* Use `git-lfs` for raw data in test (`make test` now requires `git-lfs`)
* Dropped support for HepMC 3.0.0, either HepMC version 2 or >3.1 is required
- It is now possible to write out both HepMC 2 and HepMC 3 events at the same
time
* Create [Sphinx](http://sphinx-doc.org/) and [Doxygen](http://doxygen.org/)
documentation by `make sphinx` or `make doxygen` in your `build/` folder
## Version 2.0
First release of HEJ 2. Complete code rewrite compared to HEJ 1. Improved
matching to Fixed Order ([arXiv:1805.04446](https://arxiv.org/abs/1805.04446)).
Implemented processes: Higgs boson with jets (FKL and unordered gluon emission,
with finite quark mass loop,
[arXiv:1812.08072](https://arxiv.org/abs/1812.08072)), and pure jets (only FKL).
See [arXiv:1902.08430](https://arxiv.org/abs/1902.08430)
### 2.0.6
* Fixed compiling rivet when YODA headers are _outside_ of rivet directory
### 2.0.5
* Fixed event classification for input not ordered in rapidity
### 2.0.4
* Fixed wrong path of `HEJ_INCLUDE_DIR` in `hej-config.cmake`
### 2.0.3
* Fixed parsing of (numerical factor) * (base scale) in configuration
* Don't change scale names, but sanitise Rivet output file names instead
### 2.0.2
* Changed scale names to `"_over_"` and `"_times_"` for proper file names (was
`"/"` and `"*"` before)
### 2.0.1
* Fixed name of fixed-order generator in error message.
### 2.0.0
* First release
diff --git a/include/HEJ/LesHouchesReader.hh b/include/HEJ/LesHouchesReader.hh
index 00f7765..4892ba6 100644
--- a/include/HEJ/LesHouchesReader.hh
+++ b/include/HEJ/LesHouchesReader.hh
@@ -1,54 +1,78 @@
/** \file
* \brief Header file for reading events in the Les Houches Event File format.
*
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#pragma once
#include <string>
#include "LHEF/LHEF.h"
#include "HEJ/Event.hh"
#include "HEJ/EventReader.hh"
#include "HEJ/stream.hh"
namespace HEJ{
//! Class for reading events from a file in the Les Houches Event File format
class LesHouchesReader : public EventReader{
public:
//! Contruct object reading from the given file
explicit LesHouchesReader(std::string const & filename):
stream_{filename},
reader_{stream_}
{}
//! Read an event
bool read_event() override {
return reader_.readEvent();
}
//! Access header text
std::string const & header() const override {
return reader_.headerBlock;
}
//! Access run information
LHEF::HEPRUP const & heprup() const override {
return reader_.heprup;
}
//! Access last read event
LHEF::HEPEUP const & hepeup() const override {
return reader_.hepeup;
}
private:
HEJ::istream stream_;
+
+ protected:
LHEF::Reader reader_;
};
+ /**
+ * @brief Les Houches Event file reader for LHE files created by Sherpa
+ * @details In Sherpa the cross section is given by
+ * sum(weights)/(number of trials). This EventReader converts the
+ * weights such that cross section=sum(weights)
+ * @note Reading from a pipe is not possible!
+ */
+ class SherpaLHEReader : public LesHouchesReader{
+ public:
+ explicit SherpaLHEReader(std::string const & filename);
+
+ bool read_event() override;
+
+ HEJ::optional<size_t> number_events() const override {
+ return num_events;
+ }
+
+ private:
+ double num_trials;
+ size_t num_events;
+ };
+
} // namespace HEJ
diff --git a/src/EventReader.cc b/src/EventReader.cc
index ae4fc9b..1613379 100644
--- a/src/EventReader.cc
+++ b/src/EventReader.cc
@@ -1,24 +1,68 @@
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#include "HEJ/EventReader.hh"
+
#include "HEJ/HDF5Reader.hh"
#include "HEJ/LesHouchesReader.hh"
#include "HEJ/utility.hh"
+#include "HEJ/Version.hh"
+
+namespace {
+ enum class generator{
+ HEJ,
+ Sherpa,
+ MG,
+ unknown
+ };
+
+ generator get_generator(
+ LHEF::HEPRUP const & heprup, std::string const & header
+ ){
+ // try getting generator name from specific tag
+ if(heprup.generators.size()>0){
+ std::string const & gen_name = heprup.generators.back().name;
+ if(gen_name == "HEJ" || gen_name == HEJ::Version::String())
+ return generator::HEJ;
+ if(gen_name == "MadGraph5_aMC@NLO") return generator::MG;
+ std::cerr << "Unknown LHE Generator " << gen_name
+ << " using default LHE interface.\n";
+ return generator::unknown;
+ }
+ // The generator tag is not always used -> check by hand
+ if(header.find("generated with HEJ")!=std::string::npos)
+ return generator::HEJ;
+ if(header.find("# created by SHERPA")!=std::string::npos)
+ return generator::Sherpa;
+ if(header.find("<MGVersion>")!=std::string::npos)
+ return generator::MG;
+ std::cerr<<"Could not determin LHE Generator using default LHE interface.\n";
+ return generator::unknown;
+ }
+}
namespace HEJ {
std::unique_ptr<EventReader> make_reader(std::string const & filename) {
try {
- return std::make_unique<LesHouchesReader>(filename);
+ auto reader{ std::make_unique<LesHouchesReader>(filename) };
+ switch( get_generator(reader->heprup(), reader->header()) ){
+ case generator::Sherpa:
+ return std::make_unique<SherpaLHEReader>(filename);
+ case generator::HEJ:
+ case generator::MG:
+ //! @TODO we could directly fix the MG weights here similar to Sherpa
+ default:
+ return reader;
+ }
}
catch(std::runtime_error&) {
#if HEJ_BUILD_WITH_HDF5
return std::make_unique<HDF5Reader>(filename);
#else
throw;
#endif
}
}
}
diff --git a/src/LesHouchesReader.cc b/src/LesHouchesReader.cc
new file mode 100644
index 0000000..4ced38e
--- /dev/null
+++ b/src/LesHouchesReader.cc
@@ -0,0 +1,23 @@
+#include "HEJ/LesHouchesReader.hh"
+
+#include <string>
+
+namespace HEJ{
+ SherpaLHEReader::SherpaLHEReader(std::string const & filename):
+ LesHouchesReader{filename},
+ num_trials{0.}, num_events{0}
+ {
+ LesHouchesReader tmp_reader{filename};
+ while(tmp_reader.read_event()){
+ ++num_events;
+ num_trials+=std::stod(tmp_reader.hepeup().attributes.at("trials"));
+ }
+ }
+
+ bool SherpaLHEReader::read_event() {
+ if(!LesHouchesReader::read_event()) return false;
+ for(auto & wt: reader_.hepeup.weights)
+ wt.first/=num_trials;
+ return true;
+ }
+}
diff --git a/t/CMakeLists.txt b/t/CMakeLists.txt
index aa25a75..15eb738 100644
--- a/t/CMakeLists.txt
+++ b/t/CMakeLists.txt
@@ -1,394 +1,401 @@
set(tst_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(tst_ME_data_dir "${tst_dir}/ME_data")
# small library for common test functions
add_library(hej_test SHARED hej_test.cc)
target_include_directories(hej_test PUBLIC ${tst_dir})
target_link_libraries(hej_test HEJ)
# test event classification
# test explicit configurations
add_executable(test_classify ${tst_dir}/test_classify.cc)
target_compile_options(test_classify PRIVATE "-O0") # avoid compiler optimisation
target_link_libraries(test_classify HEJ hej_test)
add_test(
NAME t_classify
COMMAND test_classify
)
# test against reference data
add_executable(test_classify_ref ${tst_dir}/test_classify_ref.cc)
target_link_libraries(test_classify_ref HEJ hej_test)
add_test(
NAME t_classify_ref
COMMAND test_classify_ref ${tst_dir}/classify_ref ${tst_dir}/classify.lhe.gz
)
add_test(
NAME t_classify_ref_4j
COMMAND test_classify_ref ${tst_dir}/classify_ref_4j ${tst_dir}/4j.lhe.gz
)
add_test(
NAME t_classify_ref_W4j
COMMAND test_classify_ref ${tst_dir}/classify_ref_W4j ${tst_dir}/MGemnubar4j_unweighted.lhe.gz
)
# test for valid W decays
add_executable(test_decay ${tst_dir}/test_decay.cc)
target_link_libraries(test_decay HEJ hej_test)
add_test(
NAME t_valid_decay
COMMAND test_decay
)
# test valid jet cuts on tagging jets
add_executable(test_jet_cuts ${tst_dir}/test_jet_cuts.cc)
target_link_libraries(test_jet_cuts HEJ hej_test)
add_test(
NAME t_jet_cuts
COMMAND test_jet_cuts
)
# test phase space point
add_executable(test_psp ${tst_dir}/test_psp.cc)
target_link_libraries(test_psp HEJ hej_test)
add_test(
NAME t_psp
COMMAND test_psp ${tst_dir}/psp_gen.lhe.gz
)
# test importing analyses
get_target_property(ANALYSIS_PATH AnalysisTemplate_lib BINARY_DIR)
get_target_property(ANALYSIS_LIB AnalysisTemplate_lib OUTPUT_NAME)
set(ANALYSIS_PARAMETERS "")
configure_file( ${tst_dir}/analysis_config.yml.in
${PROJECT_BINARY_DIR}/t/analysis_config_simple.yml @ONLY )
add_test(
NAME t_analysis_simple
COMMAND $<TARGET_FILE:HEJ_main>
${PROJECT_BINARY_DIR}/t/analysis_config_simple.yml
${tst_dir}/2j.lhe.gz
)
get_target_property(ANALYSIS_PATH AnalysisPrint_lib BINARY_DIR)
get_target_property(ANALYSIS_LIB AnalysisPrint_lib OUTPUT_NAME)
set(ANALYSIS_PARAMETERS " output: ana_output")
configure_file( ${tst_dir}/analysis_config.yml.in
${PROJECT_BINARY_DIR}/t/analysis_config_print.yml @ONLY )
add_test(
NAME t_analysis_print
COMMAND $<TARGET_FILE:HEJ_main>
${PROJECT_BINARY_DIR}/t/analysis_config_print.yml
${tst_dir}/2j.lhe.gz
)
# test importing scales (from examples/softestptScale)
add_executable(test_scale_import ${tst_dir}/test_scale_import)
target_link_libraries(test_scale_import HEJ)
get_target_property(SCALE_PATH softestptScale_lib BINARY_DIR)
get_target_property(SCALE_LIB softestptScale_lib OUTPUT_NAME)
set(SCALE_NAME "softest_jet_pt")
configure_file( ${tst_dir}/jet_config_with_import.yml.in
${PROJECT_BINARY_DIR}/t/jet_config_with_import.yml @ONLY )
add_test(
NAME t_scale_import
COMMAND test_scale_import ${PROJECT_BINARY_DIR}/t/jet_config_with_import.yml
)
# test scale arithmetic (e.g. 2*H_T/4)
add_executable(test_scale_arithmetics ${tst_dir}/test_scale_arithmetics)
target_link_libraries(test_scale_arithmetics HEJ hej_test)
add_test(
NAME t_scale_arithmetics
COMMAND test_scale_arithmetics ${tst_dir}/jet_config.yml ${tst_dir}/2j.lhe.gz
)
# test "ParameterDescription"
add_executable(test_descriptions ${tst_dir}/test_descriptions)
target_link_libraries(test_descriptions HEJ hej_test)
add_test(
NAME t_descriptions
COMMAND test_descriptions
)
# test "EventParameters*Weight"
add_executable(test_parameters ${tst_dir}/test_parameters)
target_link_libraries(test_parameters HEJ hej_test)
add_test(
NAME test_parameters
COMMAND test_parameters
)
# test unweighting
add_executable(test_unweighter ${tst_dir}/test_unweighter)
target_link_libraries(test_unweighter HEJ hej_test)
add_test(
NAME test_unweighter
COMMAND test_unweighter ${tst_dir}/4j.lhe.gz
)
# test colour generation
add_executable(test_colours ${tst_dir}/test_colours)
target_link_libraries(test_colours HEJ hej_test)
add_test(
NAME t_colour_flow
COMMAND test_colours
)
# test matrix elements
add_executable(test_ME_generic ${tst_dir}/test_ME_generic.cc)
target_link_libraries(test_ME_generic HEJ hej_test)
add_test(
NAME t_ME_j
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtinf.yml ${tst_ME_data_dir}/ME_jets_tree.dat ${tst_ME_data_dir}/PSP_jets.lhe.gz
)
add_test(
NAME t_ME_j_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtinf.yml ${tst_ME_data_dir}/ME_jets_tree_virt.dat ${tst_ME_data_dir}/PSP_jets.lhe.gz
)
add_test(
NAME t_ME_h
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtinf.yml ${tst_ME_data_dir}/ME_h_mtinf_tree.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
add_test(
NAME t_ME_h_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtinf.yml ${tst_ME_data_dir}/ME_h_mtinf_virt.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
if(QCDloop_FOUND)
add_test(
NAME t_ME_h_mt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mt.yml ${tst_ME_data_dir}/ME_h_mt_tree.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
add_test(
NAME t_ME_h_mtmb
COMMAND test_ME_generic ${tst_ME_data_dir}/config_mtmb.yml ${tst_ME_data_dir}/ME_h_mtmb_tree.dat ${tst_ME_data_dir}/PSP_h.lhe.gz
)
endif()
add_test(
NAME t_ME_j_subl
COMMAND test_ME_generic ${tst_ME_data_dir}/config_pure.yml ${tst_ME_data_dir}/ME_jets_subl_tree.dat ${tst_ME_data_dir}/PSP_jets_subl.lhe.gz
)
add_test(
NAME t_ME_j_subl_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_pure.yml ${tst_ME_data_dir}/ME_jets_subl_tree_virt.dat ${tst_ME_data_dir}/PSP_jets_subl.lhe.gz
)
add_test(
NAME t_ME_j_subl_new
COMMAND test_ME_generic ${tst_ME_data_dir}/config_pure.yml ${tst_ME_data_dir}/ME_jets_subl_tree_new.dat ${tst_dir}/4j.lhe.gz
)
add_test(
NAME t_ME_j_subl_new_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_pure.yml ${tst_ME_data_dir}/ME_jets_subl_tree_new_virt.dat ${tst_dir}/4j.lhe.gz
)
add_test(
NAME t_ME_w_FKL
COMMAND test_ME_generic ${tst_ME_data_dir}/config_w_ME.yml ${tst_ME_data_dir}/ME_w_FKL_tree.dat ${tst_ME_data_dir}/PSP_w_FKL.lhe.gz
)
add_test(
NAME t_ME_w_FKL_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_w_ME.yml ${tst_ME_data_dir}/ME_w_FKL_virt.dat ${tst_ME_data_dir}/PSP_w_FKL.lhe.gz
)
add_test(
NAME t_ME_Wp
COMMAND test_ME_generic ${tst_ME_data_dir}/config_w_ME.yml ${tst_ME_data_dir}/ME_Wp.dat ${tst_ME_data_dir}/PSP_Wp.lhe.gz
)
add_test(
NAME t_ME_Wp_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_w_ME.yml ${tst_ME_data_dir}/ME_Wp_virt.dat ${tst_ME_data_dir}/PSP_Wp.lhe.gz
)
add_test(
NAME t_ME_Wm
COMMAND test_ME_generic ${tst_ME_data_dir}/config_w_ME.yml ${tst_ME_data_dir}/ME_Wm.dat ${tst_ME_data_dir}/PSP_Wm.lhe.gz
)
add_test(
NAME t_ME_Wm_virt
COMMAND test_ME_generic ${tst_ME_data_dir}/config_w_ME.yml ${tst_ME_data_dir}/ME_Wm_virt.dat ${tst_ME_data_dir}/PSP_Wm.lhe.gz
)
# test main executable
file(COPY "${tst_dir}/jet_config.yml" DESTINATION "${PROJECT_BINARY_DIR}")
set(test_config "${PROJECT_BINARY_DIR}/jet_config.yml")
if(HighFive_FOUND)
file(READ ${test_config} config)
file(WRITE ${test_config} "${config} - tst.hdf5\n")
endif()
if(HepMC3_FOUND)
file(READ ${test_config} config)
file(WRITE ${test_config} "${config} - tst.hepmc\n")
endif()
if(HepMC_FOUND)
file(READ ${test_config} config)
file(WRITE ${test_config} "${config} - tst.hepmc2\n")
endif()
if(rivet_FOUND)
file(READ ${test_config} config)
file(WRITE ${test_config} "${config}\nanalysis:\n rivet: MC_XS\n output: tst\n")
endif()
set(test_cmd_main "$<TARGET_FILE:HEJ_main>\\\;${test_config}\\\;${tst_dir}/2j.lhe.gz")
# check that HepMC3 output is correct
if(HepMC3_FOUND)
add_executable(check_hepmc ${tst_dir}/check_hepmc.cc)
target_link_libraries(check_hepmc HEJ ${HEPMC3_LIBRARIES})
target_include_directories(check_hepmc PRIVATE ${HEPMC3_INCLUDE_DIR})
set(test_cmd_hepmc "$<TARGET_FILE:check_hepmc>\\\;tst.hepmc")
else()
set(test_cmd_hepmc "")
endif()
# check that LHEF output is correct
add_executable(check_lhe ${tst_dir}/check_lhe.cc)
target_link_libraries(check_lhe HEJ hej_test)
set(test_cmd_lhe "$<TARGET_FILE:check_lhe>\\\;tst.lhe")
# check that rivet interface is consistent with naive rivet
if(rivet_FOUND)
# this assumes "rivet" and "yodadiff" are found in PATH
if(rivet_USE_HEPMC3)
set(hepmc_file "tst.hepmc")
else()
set(hepmc_file "tst.hepmc2")
endif()
if(rivet_USE_HEPMC3 OR (rivet_VERSION VERSION_LESS 3))
set(histo_exclude "")
else()
# rivet 3 with HepMC 2 is inconsistent in order of weights
# -> interface != direct call (by permutation)
# REQUIRES Yoda 1.7.5
set(histo_exclude "-M\\\;\\\\d")
endif()
set(test_cmd_rivet "rivet\\\;-a\\\;MC_XS\\\;${hepmc_file}\\\;-o\\\;tst_direct.yoda\
\;yodadiff\\\;${histo_exclude}\\\;tst.yoda\\\;tst_direct.yoda")
else()
set(test_cmd_rivet "")
endif()
# Run dependent tests in one command to ensure correct execution order
# Note: The commands are concatenated with "\;" to escape CMake lists.
# Thus arguments have to be escaped twice "\\\;".
# e.g. "cmd1\;cmd2\\\;arg1\\\;arg2" is executed like "cmd1 && cmd2 arg1 arg2"
add_test(
NAME t_main
COMMAND ${CMAKE_COMMAND}
-DCMDS=${test_cmd_main}\;${test_cmd_hepmc}\;${test_cmd_lhe}\;${test_cmd_rivet}
-P ${PROJECT_SOURCE_DIR}/cmake/run_multiple_tests.cmake
)
+# check that Sherpas LHE input can be read
+add_executable(check_lhe_sherpa ${tst_dir}/check_lhe_sherpa.cc)
+target_link_libraries(check_lhe_sherpa HEJ)
+add_test(
+ NAME t_sherpa_reader
+ COMMAND check_lhe_sherpa ${tst_dir}/SherpaLHE.lhe 7.30234
+ )
# check HDF5 reader & writer
if(HighFive_FOUND)
add_executable(test_hdf5 ${tst_dir}/test_hdf5.cc)
target_link_libraries(test_hdf5 HEJ)
add_test(
NAME t_hdf5
COMMAND test_hdf5 ${tst_dir}/Wm9-g4-repack.hdf5
)
add_executable(test_hdf5_write ${tst_dir}/test_hdf5_write.cc)
target_link_libraries(test_hdf5_write HEJ)
add_test(
NAME t_hdf5_write
COMMAND test_hdf5_write ${tst_dir}/Wm9-g4-repack.hdf5
)
endif()
# check rivet interface
if(RIVET_FOUND)
add_executable(check_rivet ${tst_dir}/check_rivet.cc)
target_link_libraries(check_rivet HEJ rivet::rivet)
add_test(
NAME t_rivet
COMMAND check_rivet
)
endif()
# test boson reconstruction
add_executable(cmp_events ${tst_dir}/cmp_events.cc)
target_link_libraries(cmp_events HEJ)
add_test(
NAME t_epnu_2j_noW
COMMAND cmp_events ${tst_dir}/epnu2jLOFKL_unweight.lhe.tar.gz ${tst_dir}/epnu2jLOFKL_unweight_noW.lhe.gz
)
# test resummed result
add_executable(check_res ${tst_dir}/check_res.cc)
target_link_libraries(check_res HEJ hej_test)
if(TEST_ALL) # deactivate long tests by default
add_test(
NAME t_2j
COMMAND check_res ${tst_dir}/2j.lhe.gz 3.49391e+07 419684
)
add_test(
NAME t_3j
COMMAND check_res ${tst_dir}/3j.lhe.gz 2.37902e+06 25746.6
)
add_test(
NAME t_3j_unof
COMMAND check_res ${tst_dir}/3j.lhe.gz 133399 4688.83 unof
)
add_test(
NAME t_3j_unob
COMMAND check_res ${tst_dir}/3j.lhe.gz 105247 3449.45 unob
)
add_test(
NAME t_3j_splitf
COMMAND check_res ${tst_dir}/3j.lhe.gz 97659.9 2748.65 splitf
)
add_test(
NAME t_3j_splitb
COMMAND check_res ${tst_dir}/3j.lhe.gz 107150 2799.8 splitb
)
add_test(
NAME t_4j
COMMAND check_res ${tst_dir}/4j.lhe.gz 603713 72822.6
)
add_test(
NAME t_4j_qqxmid
COMMAND check_res ${tst_dir}/4j.lhe.gz 21866.7 1716.96 qqxmid
)
add_test(
NAME t_h_3j
COMMAND check_res ${tst_dir}/h_3j.lhe.gz 0.821622 0.0220334
)
add_test(
NAME t_h_3j_unof
COMMAND check_res ${tst_dir}/h_3j_uno.lhe.gz 0.0127362 0.000271555 unof
)
add_test(
NAME t_h_3j_unob
COMMAND check_res ${tst_dir}/h_3j_uno.lhe.gz 0.0130615 0.000224793 unob
)
add_test(
NAME t_epnu_2j
COMMAND check_res ${tst_dir}/epnu2jLOFKL_unweight.lhe.tar.gz 262.7 3
)
add_test(
NAME t_MGepnu_3j
COMMAND check_res ${tst_dir}/MGepnu3j_unweighted.lhe.gz 38.9512 1
)
add_test(
NAME t_MGemnubar_3j
COMMAND check_res ${tst_dir}/MGemnubar3j_unweighted.lhe.gz 24.1575 1
)
add_test(
NAME t_MGepnu_3j_unof
COMMAND check_res ${tst_dir}/MGepnu3j_unweighted.lhe.gz 9.63702 0.128355 unof
)
add_test(
NAME t_MGepnu_3j_unob
COMMAND check_res ${tst_dir}/MGepnu3j_unweighted.lhe.gz 9.70119 0.108436 unob
)
add_test(
NAME t_MGepnu_3j_splitf
COMMAND check_res ${tst_dir}/MGepnu3j_unweighted.lhe.gz 2.91995 0.0463182 splitf
)
add_test(
NAME t_MGepnu_3j_splitb
COMMAND check_res ${tst_dir}/MGepnu3j_unweighted.lhe.gz 3.40708 0.0550975 splitb
)
add_test(
NAME t_MGepnu_4j
COMMAND check_res ${tst_dir}/MGepnu4j_unweighted.lhe.gz 10.2542 0.135106
)
add_test(
NAME t_MGemnubar_4j
COMMAND check_res ${tst_dir}/MGemnubar4j_unweighted.lhe.gz 5.57909 0.0300496
)
add_test(
NAME t_MGepnu_4j_qqxmid
COMMAND check_res ${tst_dir}/MGepnu4j_unweighted.lhe.gz 0.732084 0.005 qqxmid
)
endif()
diff --git a/t/ME_data/PSP_jets_subl.lhe.gz b/t/ME_data/PSP_jets_subl.lhe.gz
index 8f01d14..df8bed4 100644
--- a/t/ME_data/PSP_jets_subl.lhe.gz
+++ b/t/ME_data/PSP_jets_subl.lhe.gz
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3a1d4f8497ac0cb6ba0f0832c721f60b90f5db6a1fd47600402b3686e4873c68
-size 1023579
+oid sha256:a23f12fab2f4b2eeaca70345d4169dee5e2758a95c7278cc16f8486c668a6b02
+size 1023608
diff --git a/t/SherpaLHE.lhe b/t/SherpaLHE.lhe
new file mode 100644
index 0000000..8773f01
--- /dev/null
+++ b/t/SherpaLHE.lhe
@@ -0,0 +1,193 @@
+<LesHouchesEvents version="1.0">
+<header>
+<!--
+# created by SHERPA 2.2.8
+# Run data extracted from : Run.dat
+-->
+<SHRunCard>
+(run){
+ # Cut variables
+ JETR:=0.4;
+ MINPT:=30.;
+ MAXETA:=4.4;
+
+ #photon cuts
+ EtaG:=2.37;
+
+ #general Setup
+ EBEAM:=6500.;
+ HIGGSMASS:=125.;
+ NJETS:=2;
+ RSEED:=816;
+
+ EVENT_OUTPUT=LHEF[SherpaLHE]
+ ANALYSIS Rivet
+ #EVENT_OUTPUT=HepMC_GenEvent[SherpaHepMC]
+ USE_GZIP=0;
+ #HEPMC_USE_NAMED_WEIGHTS=1
+
+ % general settings
+ EVENTS 20k;
+ RANDOM_SEED=RSEED
+ ANALYSIS_OUTPUT=test_output/ANALYSIS-RSEED
+
+ % ME setup
+ FRAGMENTATION=Off; #hadronization
+ YFS_MODE 0; #photon corrction
+ MI_HANDLER=None; #multi parton
+ CSS_MAXEM=0; #parton shower (SHOWER_GENERATOR=None does not work with PDF)
+ BEAM_REMNANTS=0;
+
+ % ME generator
+ # EVENT_GENERATION_MODE U;
+ ME_SIGNAL_GENERATOR Comix;
+ #OL_PARAMETERS verbose 4 model heft
+
+ # PDF
+ PDF_LIBRARY=LHAPDFSherpa;
+ PDF_SET CT14nlo;
+
+ # scales
+ SCALES VAR{HIGGSMASS*HIGGSMASS};
+
+ # collider setup
+ BEAM_1 2212 EBEAM; BEAM_2 2212 EBEAM;
+
+ # model parameters (should be the same for all generators)
+ EW_SCHEME = 4;
+ 1/ALPHAQED(0) = 132.232;
+ USE_PDF_ALPHAS 1;
+
+ # HEFT
+ MODEL = HEFT;
+
+ # h>yy
+ # HARD_DECAYS On;
+ # HDH_STATUS[25,22,22] 2;
+ # HDH_BR_WEIGHTS 0;
+
+ # Higgs
+ MASS[25] HIGGSMASS;
+ WIDTH[25] 0;
+
+ # decay width (from PDG)
+ WIDTH[6] 1.35; #top
+ WIDTH[23] 2.4952;
+ WIDTH[24] 2.085;
+
+ # massless c
+ MASSIVE[4] 0;
+ YUKAWA[4] 0.;
+ MASS[4] 0.;
+
+ # massless b-quark (5 flavour scheme)
+ MASSIVE[5] 0;
+ YUKAWA[5] 0.;
+ MASS[5] 0.;
+}(run);
+
+(processes){
+ Process 93 93 -> 25 93 93;
+ Order (*,0,1);
+ End process;
+}(processes);
+
+(selector){
+ FastjetFinder antikt NJETS MINPT 0 JETR 0.75 MAXETA;
+ #PseudoRapidity 93 -MAXETA MAXETA;
+ #RapidityNLO 22 -EtaG EtaG;
+}(selector);
+
+(analysis){
+ BEGIN_RIVET {
+ # USE_HEPMC_SHORT 1
+ -a MC_XS
+ } END_RIVET;
+}(analysis);
+</SHRunCard>
+</header>
+<init>
+ 2212 2212 6500 6500 0 0 13100 13100 3 1
+ 1 1 1 1
+</init>
+<event trials='136' muf2='15625' mur2='15625'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 5.8025410883e+01 5.8025410883e+01 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -2.5328447719e+02 2.5328447719e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -7.4663273830e+01 -4.0330270325e-02 -7.5082419490e+01 1.6381994934e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 4.1233078409e+01 -3.1730398953e+00 -2.9513308115e+01 5.0806203293e+01 0.0000000000e+00 0 9
+ 21 1 1 2 0 0 3.3430195422e+01 3.2133701657e+00 -9.0663338699e+01 9.6683735435e+01 0.0000000000e+00 0 9
+</event>
+<event trials='234' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ -1 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 1.0280145853e+03 1.0280145853e+03 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -9.4396762441e+01 9.4396762441e+01 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -8.3115389810e+01 -3.4356390512e+01 2.9543045318e+00 1.5402031524e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 -4.3793711101e-01 6.4591614403e+01 8.3624873770e+02 8.3873966148e+02 0.0000000000e+00 0 9
+ -1 1 1 2 0 0 8.3553326921e+01 -3.0235223891e+01 9.4414780603e+01 1.2965137099e+02 0.0000000000e+00 0 9
+</event>
+<event trials='315' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 1.8483409705e+02 1.8483409705e+02 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -2.3966145432e+02 2.3966145432e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -2.3579448991e+01 1.0740594582e+02 1.8637084411e+00 1.6649474773e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 7.4221597329e+01 4.5255391139e+01 -4.1838428278e+01 9.6474608151e+01 0.0000000000e+00 0 9
+ 21 1 1 2 0 0 -5.0642148338e+01 -1.5266133695e+02 -1.4852637432e+01 1.6152619548e+02 0.0000000000e+00 0 9
+</event>
+<event trials='434' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 9.5199817814e+02 9.5199817814e+02 0.0000000000e+00 0 9
+ 1 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -2.3118284746e+02 2.3118284746e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 1.6074114402e+01 -1.7348915963e+02 7.5829642363e+02 7.8803257023e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 -8.9196833362e+01 6.7032099709e+01 1.3787378324e+02 1.7736560427e+02 0.0000000000e+00 0 9
+ 1 1 1 2 0 0 7.3122718960e+01 1.0645705992e+02 -1.7535487618e+02 2.1778285110e+02 0.0000000000e+00 0 9
+</event>
+<event trials='103' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 4.9602730192e+02 4.9602730192e+02 0.0000000000e+00 0 9
+ 1 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -5.9397146300e+01 5.9397146300e+01 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -8.6455293928e+01 8.2258755216e+01 3.4861963726e+02 3.8910367788e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 3.7561988541e+01 -8.3222441511e+01 4.8112083168e+01 1.0320683263e+02 0.0000000000e+00 0 9
+ 1 1 1 2 0 0 4.8893305386e+01 9.6368629447e-01 3.9898435198e+01 6.3113937717e+01 0.0000000000e+00 0 9
+</event>
+<event trials='110' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 7.6377303450e+01 7.6377303450e+01 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -3.5828773242e+02 3.5828773242e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -5.0520141165e+01 -6.7444993738e+01 -6.1760249858e+01 1.6291237002e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 1.6297364734e+01 3.4476163040e+01 -2.2095933533e+02 2.2422586332e+02 0.0000000000e+00 0 9
+ 21 1 1 2 0 0 3.4222776431e+01 3.2968830699e+01 8.0915621539e-01 4.7526802523e+01 0.0000000000e+00 0 9
+</event>
+<event trials='463' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 5.2821679274e+02 5.2821679274e+02 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -3.4421903441e+02 3.4421903441e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -6.5673473351e+01 2.2015669241e+02 -1.5294572011e+02 3.0298410456e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 7.2900044050e+01 -6.2609377318e+01 -7.9135034398e+01 1.2448575910e+02 0.0000000000e+00 0 9
+ 21 1 1 2 0 0 -7.2265706987e+00 -1.5754731509e+02 4.1607851284e+02 4.4496596349e+02 0.0000000000e+00 0 9
+</event>
+<event trials='318' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 2 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 1.2225588672e+03 1.2225588672e+03 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -3.0527067799e+02 3.0527067799e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -1.8009071923e+02 -4.9143451060e+02 9.2170911251e+01 5.4594965175e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 1.1016514431e+00 9.0020329940e+01 1.0583144744e+02 1.3894304123e+02 0.0000000000e+00 0 9
+ 2 1 1 2 0 0 1.7898906779e+02 4.0141418066e+02 7.1928583049e+02 8.4293685218e+02 0.0000000000e+00 0 9
+</event>
+<event trials='181' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 1 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 1.7158079005e+03 1.7158079005e+03 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -2.4704769131e+02 2.4704769131e+02 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 -4.6664790403e+01 -7.4390342186e+01 -2.2062521538e+02 2.6835053817e+02 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 3.9678220534e+01 -4.4184327396e+00 2.7212574251e+02 2.7503873086e+02 0.0000000000e+00 0 9
+ 1 1 1 2 0 0 6.9865698689e+00 7.8808774926e+01 1.4172596821e+03 1.4194663228e+03 0.0000000000e+00 0 9
+</event>
+<event trials='61' muf2='1.5625000000e+04' mur2='1.5625000000e+04'>
+ 5 1 1.7197008255e+03 1.2500000000e+02 -1.0000000000e+00 1.1264802949e-01
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 2.0311454232e+03 2.0311454232e+03 0.0000000000e+00 0 9
+ 21 -1 0 0 0 0 0.0000000000e+00 0.0000000000e+00 -8.3219978248e+01 8.3219978248e+01 0.0000000000e+00 0 9
+ 25 1 1 2 0 0 1.5288864333e+02 -5.6894718277e+01 9.9796481721e+02 1.0189066310e+03 1.2500000000e+02 0 9
+ 21 1 1 2 0 0 -1.0202711033e+02 2.3271099316e+01 1.0067279463e+03 1.0121522776e+03 0.0000000000e+00 0 9
+ 21 1 1 2 0 0 -5.0861533002e+01 3.3623618961e+01 -5.6767318558e+01 8.3306492830e+01 0.0000000000e+00 0 9
+</event>
+</LesHouchesEvents>
diff --git a/t/check_lhe.cc b/t/check_lhe.cc
index d10cc88..b2376af 100644
--- a/t/check_lhe.cc
+++ b/t/check_lhe.cc
@@ -1,50 +1,47 @@
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#include <iostream>
#include <unordered_map>
#include "HEJ/event_types.hh"
-#include "HEJ/stream.hh"
-
-#include "LHEF/LHEF.h"
+#include "HEJ/EventReader.hh"
#include "hej_test.hh"
static constexpr double ep = 1e-3;
int main(int argn, char** argv) {
if(argn != 2){
- std::cerr << "Usage: check_lhe lhe_file\n";
+ std::cerr << "Usage: " << argv[0] << " lhe_file\n";
return EXIT_FAILURE;
}
- HEJ::istream in{argv[1]};
- LHEF::Reader reader{in};
+ auto reader{ HEJ::make_reader(argv[1]) };
std::unordered_map<int, double> xsec_ref;
- for(int i=0; i < reader.heprup.NPRUP; ++i)
- xsec_ref[reader.heprup.LPRUP[i]] = 0.;
+ for(int i=0; i < reader->heprup().NPRUP; ++i)
+ xsec_ref[reader->heprup().LPRUP[i]] = 0.;
- while(reader.readEvent()){
- ASSERT(reader.hepeup.NUP > 2); // at least 3 particles (2 in + 1 out)
+ while(reader->read_event()){
+ ASSERT(reader->hepeup().NUP > 2); // at least 3 particles (2 in + 1 out)
// first incoming has positive pz
- ASSERT(reader.hepeup.PUP[0][2] > reader.hepeup.PUP[1][2]);
+ ASSERT(reader->hepeup().PUP[0][2] > reader->hepeup().PUP[1][2]);
// test that we can trasform IDPRUP to event type
- (void) name(static_cast<HEJ::event_type::EventType>(reader.hepeup.IDPRUP));
- xsec_ref[reader.hepeup.IDPRUP] += reader.hepeup.weight();
+ (void) name(static_cast<HEJ::event_type::EventType>(reader->hepeup().IDPRUP));
+ xsec_ref[reader->hepeup().IDPRUP] += reader->hepeup().weight();
}
for(size_t i = 0; i < xsec_ref.size(); ++i){
- double const ref = xsec_ref[reader.heprup.LPRUP[i]];
- double const calc = reader.heprup.XSECUP[i];
+ double const ref = xsec_ref[reader->heprup().LPRUP[i]];
+ double const calc = reader->heprup().XSECUP[i];
std::cout << ref << '\t' << calc << '\n';
if(std::abs(calc-ref) > ep*calc){
std::cerr << "Cross sections deviate substantially";
return EXIT_FAILURE;
}
}
return EXIT_SUCCESS;
}
diff --git a/t/check_lhe_sherpa.cc b/t/check_lhe_sherpa.cc
new file mode 100644
index 0000000..62dbda1
--- /dev/null
+++ b/t/check_lhe_sherpa.cc
@@ -0,0 +1,40 @@
+/**
+ * \authors The HEJ collaboration (see AUTHORS for details)
+ * \date 2019
+ * \copyright GPLv2 or later
+ */
+#include <iostream>
+#include <string>
+
+#include "HEJ/LesHouchesReader.hh"
+
+static constexpr double ep = 1e-3;
+
+int main(int argn, char** argv) {
+ if(argn != 3){
+ std::cerr << "Usage: " << argv[0] << " lhe_file xs\n";
+ return EXIT_FAILURE;
+ }
+
+ auto reader{ HEJ::make_reader(argv[1])};
+
+ const double ref_xs = std::stod(argv[2]);
+
+ double xs { 0. };
+ size_t n_evts { 0 };
+ while(reader->read_event()){
+ ++n_evts;
+ xs += reader->hepeup().weight();
+ }
+
+ if(std::abs(xs-ref_xs) > ep*xs){
+ std::cerr << "Cross sections deviate substantially!\n"
+ <<"Found "<< xs <<" but expected "<< ref_xs <<" -> "<< xs/ref_xs <<"\n";
+ return EXIT_FAILURE;
+ }
+ if(!reader->number_events() || *(reader->number_events()) != n_evts){
+ std::cerr << "Number of Event not set for Sherpa LHE reader\n";
+ return EXIT_SUCCESS;
+ }
+ return EXIT_SUCCESS;
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Feb 23, 2:58 PM (40 m, 49 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4486751
Default Alt Text
(42 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment