Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8724075
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Subscribers
None
View Options
diff --git a/FixedOrderGen/CMakeLists.txt b/FixedOrderGen/CMakeLists.txt
index da25e82..cbbbcde 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)
+foreach(tst h_2j h_3j h_5j h_3j_uno1 h_3j_uno2 h_2j_decay 2j 4j W_2j_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_2j_classify.cc b/FixedOrderGen/t/W_2j_classify.cc
new file mode 100644
index 0000000..d65b954
--- /dev/null
+++ b/FixedOrderGen/t/W_2j_classify.cc
@@ -0,0 +1,105 @@
+#ifdef NDEBUG
+#undef NDEBUG
+#endif
+
+#include "PhaseSpacePoint.hh"
+#include "Process.hh"
+#include "JetParameters.hh"
+#include "HiggsProperties.hh"
+
+#include "RHEJ/Mixmax.hh"
+#include "RHEJ/PDF.hh"
+#include "RHEJ/utility.hh"
+
+using namespace HEJFOG;
+using namespace RHEJ;
+
+
+namespace {
+ void print_event(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_event(psp);
+ throw std::logic_error{msg};
+ }
+
+ bool is_up_type(Particle const & part){
+ return RHEJ::is_anyquark(part) && !(abs(part.type)%2);
+ }
+ bool is_down_type(Particle const & part){
+ return RHEJ::is_anyquark(part) && abs(part.type)%2;
+ }
+}
+
+int main(){
+ constexpr size_t n_psp_base = 1337;
+ const JetParameters jet_para{
+ fastjet::JetDefinition(fastjet::JetAlgorithm::antikt_algorithm, 0.4), 20,5,30};
+ PDF pdf(11000, pid::proton, pid::proton);
+ constexpr double E_cms = 13000.;
+ constexpr double subl_change = 0.5;
+ const HiggsProperties higgs_para{125., 0.001,
+ {Decay{{pid::photon, pid::photon},1.}}};
+ RHEJ::Mixmax ran{};
+
+ // W2j
+ const Process proc {{pid::proton,pid::proton}, 2, pid::Wp};
+ size_t n_psp = n_psp_base;
+ size_t t_fail = 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){
+ bool found_quark = false;
+ bool found_anti = false;
+ auto out_partons = filter_partons(psp.outgoing());
+ for(size_t j=0; j<2; ++j){
+ auto const & in = psp.incoming()[j];
+ auto const & out = out_partons[j];
+ if(is_quark(in) || is_antiquark(in)) {
+ found_quark = true;
+ if(in.type != out.type) { // switch in quark type -> Wp couples to it
+ if(found_anti){ // already found qq for coupling to W
+ bail_out(psp, "Found second up/down pair");
+ }
+ found_anti = true;
+ if( is_up_type(in)) { // "up" in
+ // -> only allowed u -> Wp + d
+ if(in.type < 0 || is_up_type(out) || out.type < 0){
+ // not in "q" or out "up" or out "qx" -> bail out
+ bail_out(psp, "u -/> Wp + d");
+ }
+ } else { // "down" in
+ // -> only allowed dx -> Wp + ux
+ if(in.type > 0 || is_down_type(out) || out.type > 0){
+ // not in "qx" or out "down" or out "q" -> bail out
+ bail_out(psp, "dx -/> Wp + ux");
+ }
+ }
+ }
+ }
+ }
+ if(!found_quark) {
+ bail_out(psp, "Found no initial quarks");
+ } else if(!found_anti){
+ bail_out(psp, "Found no up/down pair");
+ }
+ } else { // bad process -> try again
+ ++n_psp;
+ if(psp.status()==wrong_final_state) ++t_fail;
+ }
+ }
+ // @TODO test final state for 3j
+
+ std::cout << "All processes passed.\nTook " << 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;
+ 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
4242646
Default Alt Text
(7 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment