Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8724091
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Subscribers
None
View Options
diff --git a/FixedOrderGen/CMakeLists.txt b/FixedOrderGen/CMakeLists.txt
index cbbbcde..51c0e1d 100644
--- a/FixedOrderGen/CMakeLists.txt
+++ b/FixedOrderGen/CMakeLists.txt
@@ -1,110 +1,110 @@
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 0.0.1 LANGUAGES C CXX)
## Flags for the compiler. No warning allowed.
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
elseif (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /EHsc")
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
## 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
${PROJECT_BINARY_DIR}/include/Version.hh @ONLY )
## Add directories and find dependences
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${PROJECT_BINARY_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../include)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../cmake/Modules/")
find_package(rHEJ REQUIRED)
include_directories(${RHEJ_INCLUDE_PATH})
find_package(fastjet REQUIRED)
include_directories(${fastjet_INCLUDE_PATH})
find_package(clhep 2.3 REQUIRED)
include_directories(${clhep_INCLUDE_PATH})
find_package(lhapdf REQUIRED)
include_directories(${lhapdf_INCLUDE_PATH})
## 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)
include_directories(${Boost_INCLUDE_DIRS})
find_package(yaml-cpp)
include_directories(${YAML_CPP_INCLUDE_DIR})
find_package(QCDloop 2)
if(${QCDloop_FOUND})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DRHEJ_BUILD_WITH_QCDLOOP")
include_directories(SYSTEM ${QCDloop_INCLUDE_DIRS})
endif()
## define executable
file(GLOB FOgen_source ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
list(REMOVE_ITEM FOgen_source ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc)
add_library(hejfog STATIC ${FOgen_source})
add_executable(FOgen ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc)
## link libraries
set(libraries ${CMAKE_DL_LIBS} ${LHAPDF_LIBRARIES} ${CLHEP_LIBRARIES}
${FASTJET_LIBRARIES} ${Boost_LIBRARIES} ${YAML_CPP_LIBRARIES} ${RHEJ_LIBRARIES})
if(${QCDloop_FOUND})
list(APPEND libraries ${QCDloop_LIBRARIES} quadmath)
endif()
target_link_libraries(hejfog ${libraries})
target_link_libraries(FOgen hejfog)
install(TARGETS FOgen DESTINATION bin)
## tests
enable_testing()
set(tst_dir "${CMAKE_CURRENT_SOURCE_DIR}/t")
-foreach(tst h_2j h_3j h_5j h_3j_uno1 h_3j_uno2 h_2j_decay 2j 4j W_2j_classify)
+foreach(tst h_2j h_3j h_5j h_3j_uno1 h_3j_uno2 h_2j_decay 2j 4j W_2j_classify W_nj_classify)
add_executable(test_${tst} ${tst_dir}/${tst}.cc)
target_link_libraries(test_${tst} hejfog)
add_test(NAME t_${tst} COMMAND test_${tst} WORKING_DIRECTORY ${tst_dir})
endforeach()
add_test(
NAME t_main_2j
COMMAND FOgen ${tst_dir}/config_2j.yml
)
add_test(
NAME t_main_h2j
COMMAND FOgen ${tst_dir}/config_h_2j.yml
)
add_test(
NAME t_main_h2j_decay
COMMAND FOgen ${tst_dir}/config_h_2j_decay.yml
)
diff --git a/FixedOrderGen/t/W_nj_classify.cc b/FixedOrderGen/t/W_nj_classify.cc
new file mode 100644
index 0000000..ba65db3
--- /dev/null
+++ b/FixedOrderGen/t/W_nj_classify.cc
@@ -0,0 +1,132 @@
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
+#include <algorithm>
+
+#include "PhaseSpacePoint.hh"
+#include "Process.hh"
+#include "JetParameters.hh"
+#include "HiggsProperties.hh"
+
+#include "RHEJ/Event.hh"
+#include "RHEJ/Mixmax.hh"
+#include "RHEJ/PDF.hh"
+#include "RHEJ/utility.hh"
+
+using namespace HEJFOG;
+using namespace RHEJ;
+
+namespace {
+ void print_psp(PhaseSpacePoint const & psp){
+ std::cerr << "Process:\n"
+ << psp.incoming()[0].type << " + "<< psp.incoming()[1].type << " -> ";
+ for(auto const & out: psp.outgoing()){
+ std::cerr << out.type << " ";
+ }
+ std::cerr << "\n";
+ }
+ void bail_out(PhaseSpacePoint const & psp, std::string msg){
+ print_psp(psp);
+ throw std::logic_error{msg};
+ }
+}
+
+int main(){
+ constexpr size_t n_psp_base = 19375;
+ const JetParameters jet_para{
+ fastjet::JetDefinition(fastjet::JetAlgorithm::antikt_algorithm, 0.4), 30, 5, 30};
+ PDF pdf(11000, pid::proton, pid::proton);
+ constexpr double E_cms = 13000.;
+ constexpr double subl_change = 0.8;
+ const HiggsProperties higgs_para{125., 0.001,
+ {Decay{{pid::photon, pid::photon},1.}}};
+ RHEJ::Mixmax ran{};
+ std::vector<event_type::EventType> allowed_types{event_type::FKL,
+ event_type::unob, event_type::unof, event_type::qqxexb, event_type::qqxexf};
+
+ // Wp3j
+ Process proc {{pid::proton,pid::proton}, 3, pid::Wp};
+ size_t n_psp = n_psp_base;
+ size_t t_fail = 0;
+ std::map<event_type::EventType, size_t> type_counter;
+ for( size_t i = 0; i<n_psp; ++i){
+ const PhaseSpacePoint psp{proc,jet_para,pdf, E_cms, subl_change, higgs_para, ran};
+ if(psp.status()==good){
+ const Event ev(to_UnclusteredEvent(psp), jet_para.def, jet_para.min_pt);
+ ++type_counter[ev.type()];
+ if( std::find(allowed_types.cbegin(), allowed_types.cend(), ev.type())
+ == allowed_types.cend()) {
+ bail_out(psp, "Found not allowed event of type "
+ +std::string(event_type::names[ev.type()]));
+ }
+ } else { // bad process -> try again
+ ++n_psp;
+ if(psp.status()==wrong_final_state) ++t_fail;
+ }
+ }
+ std::cout << "Wp+3j: Took " << n_psp << " to generate "
+ << n_psp_base << " successfully PSP (" << 1.*n_psp/n_psp_base << " trials/PSP)" << std::endl;
+ std::cout << "Failed for wrong final state " << t_fail
+ << " (" << 100.*t_fail/(n_psp-n_psp_base) << " % of fails)" << std::endl;
+ std::cout << "States by classification:\n";
+ for(auto const & entry: type_counter){
+ const double fraction = static_cast<double>(entry.second)/n_psp_base;
+ const int percent = std::round(100*fraction);
+ std::cout << std::left << std::setw(25)
+ << (event_type::names[entry.first] + std::string(":"))
+ << entry.second << " (" << percent << "%)\n";
+
+ }
+ for(auto const & t: allowed_types){
+ if(type_counter[t] < 0.05 * n_psp_base){
+ std::cerr << "Less than 5% of the events are of type " << event_type::names[t] << std::endl;
+ return EXIT_FAILURE;
+ }
+ }
+
+ // Wm4j
+ proc = Process{{pid::proton,pid::proton}, 4, pid::Wm};
+ n_psp = n_psp_base;
+ t_fail = 0;
+ allowed_types.push_back(event_type::qqxmid);
+ for(auto & entry: type_counter)
+ entry.second = 0;
+ for( size_t i = 0; i<n_psp; ++i){
+ const PhaseSpacePoint psp{proc,jet_para,pdf, E_cms, subl_change, higgs_para, ran};
+ if(psp.status()==good){
+ const Event ev(to_UnclusteredEvent(psp), jet_para.def, jet_para.min_pt);
+ ++type_counter[ev.type()];
+ if( std::find(allowed_types.cbegin(), allowed_types.cend(), ev.type())
+ == allowed_types.cend()) {
+ bail_out(psp, "Found not allowed event of type "
+ +std::string(event_type::names[ev.type()]));
+ }
+ } else { // bad process -> try again
+ ++n_psp;
+ if(psp.status()==wrong_final_state) ++t_fail;
+ }
+ }
+ std::cout << "Wm+4j: Took " << n_psp << " to generate "
+ << n_psp_base << " successfully PSP (" << 1.*n_psp/n_psp_base << " trials/PSP)" << std::endl;
+ std::cout << "Failed for wrong final state " << t_fail
+ << " (" << 100.*t_fail/(n_psp-n_psp_base) << " % of fails)" << std::endl;
+ std::cout << "States by classification:\n";
+ for(auto const & entry: type_counter){
+ const double fraction = static_cast<double>(entry.second)/n_psp_base;
+ const int percent = std::round(100*fraction);
+ std::cout << std::left << std::setw(25)
+ << (event_type::names[entry.first] + std::string(":"))
+ << entry.second << " (" << percent << "%)\n";
+
+ }
+ for(auto const & t: allowed_types){
+ if(type_counter[t] < 0.05 * n_psp_base){
+ std::cerr << "Less than 5% of the events are of type " << event_type::names[t] << std::endl;
+ return EXIT_FAILURE;
+ }
+ }
+
+ std::cout << "All processes passed." << std::endl;
+ return EXIT_SUCCESS;
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jan 20, 10:26 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4242658
Default Alt Text
(8 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment