Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F10880944
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
15 KB
Subscribers
None
View Options
diff --git a/FixedOrderGen/.clang-tidy b/FixedOrderGen/.clang-tidy
new file mode 100644
index 0000000..5934b52
--- /dev/null
+++ b/FixedOrderGen/.clang-tidy
@@ -0,0 +1,50 @@
+Checks: '
+ *,
+ -abseil-*,
+ -android-*,
+ -bugprone-*,
+ -cert-*,
+ -clang-analyzer-*,
+ -cppcoreguidelines-*,
+ -google-*,
+ -llvm-*,
+ -misc-*,
+ -modernize-*,
+ -performance-*,
+ -readability-*,
+ -cert-dcl21-cpp,
+ -clang-analyzer-optin.cplusplus.VirtualCall,
+ -cppcoreguidelines-avoid-magic-numbers,
+ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,
+ -cppcoreguidelines-pro-bounds-constant-array-index,
+ -fuchsia*,
+ -google-build-using-namespace,
+ -google-explicit-constructor,
+ -google-readability*,
+ -google-runtime-int,
+ -google-runtime-references,
+ -hicpp*,
+ -llvm-header-guard,
+ -modernize-use-trailing-return-type,
+ -readability-braces-around-statements,
+ -readability-uppercase-literal-suffix,
+ '
+CheckOptions:
+ - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
+ value: '1'
+ - key: llvm-namespace-comment.ShortNamespaceLines
+ value: '10'
+ - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
+ value: '1'
+ - key: performance-move-const-arg.CheckTriviallyCopyableMove
+ value: '0'
+ - key: readability-identifier-naming.GlobalConstantCase
+ value: UPPER_CASE
+ - key: readability-identifier-naming.GlobalVariableCase
+ value: UPPER_CASE
+ - key: readability-identifier-naming.PrivateMemberSuffix
+ value: '_'
+ - key: readability-implicit-bool-conversion.AllowIntegerConditions
+ value: '1'
+ - key: readability-magic-numbers.IgnoreAllFloatingPointValues
+ value: '1'
diff --git a/FixedOrderGen/CMakeLists.txt b/FixedOrderGen/CMakeLists.txt
index b11a719..992f3ba 100644
--- a/FixedOrderGen/CMakeLists.txt
+++ b/FixedOrderGen/CMakeLists.txt
@@ -1,89 +1,106 @@
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.0.6 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)
# 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 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
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/FixedOrderGen/include/PhaseSpacePoint.hh b/FixedOrderGen/include/PhaseSpacePoint.hh
index 9873390..b0c1452 100644
--- a/FixedOrderGen/include/PhaseSpacePoint.hh
+++ b/FixedOrderGen/include/PhaseSpacePoint.hh
@@ -1,298 +1,298 @@
/** \file PhaseSpacePoint.hh
* \brief Contains the PhaseSpacePoint Class
*
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019-2020
* \copyright GPLv2 or later
*/
#pragma once
#include <array>
#include <bitset>
#include <cstddef>
#include <unordered_map>
#include <vector>
#include "boost/iterator/filter_iterator.hpp"
#include "HEJ/Event.hh"
#include "HEJ/Particle.hh"
#include "HEJ/PDG_codes.hh"
#include "fastjet/PseudoJet.hh"
#include "Decay.hh"
#include "Status.hh"
#include "Subleading.hh"
namespace HEJ {
class EWConstants;
class PDF;
class RNG;
}
namespace HEJFOG {
- class JetParameters;
- class Process;
+ struct JetParameters;
+ struct Process;
//! A point in resummation phase space
class PhaseSpacePoint{
public:
//! Iterator over partons
using ConstPartonIterator = boost::filter_iterator<
bool (*)(HEJ::Particle const &),
std::vector<HEJ::Particle>::const_iterator
>;
//! Reverse Iterator over partons
using ConstReversePartonIterator = std::reverse_iterator<
ConstPartonIterator>;
//! Default PhaseSpacePoint Constructor
PhaseSpacePoint() = delete;
//! PhaseSpacePoint Constructor
/**
* @param proc The process to generate
* @param jet_properties Jet defintion & cuts
* @param pdf The pdf set (used for sampling)
* @param E_beam Energie of the beam
* @param subl_chance Chance to turn a potentially unordered
* emission into an actual one
* @param subl_channels Possible subleading channels.
* see HEJFOG::Subleading
* @param particle_properties Properties of producted boson
*
* Initially, only FKL phase space points are generated. subl_chance gives
* the chance of turning one emissions into a subleading configuration,
* i.e. either unordered or central quark/anti-quark pair. Unordered
* emissions require that the most extremal emission in any direction is
* a quark or anti-quark and the next emission is a gluon. Quark/anti-quark
* pairs are only generated for W processes. At most one subleading
* emission will be generated in this way.
*/
PhaseSpacePoint(
Process const & proc,
JetParameters const & jet_properties,
HEJ::PDF & pdf, double E_beam,
double subl_chance,
Subleading subl_channels,
ParticlesDecayMap const & particle_decays,
HEJ::EWConstants const & ew_parameters,
HEJ::RNG & ran
);
//! Get Weight Function
/**
* @returns Weight of Event
*/
double weight() const{
return weight_;
}
Status status() const{
return status_;
}
//! Get Incoming Function
/**
* @returns Incoming Particles
*/
std::array<HEJ::Particle, 2> const & incoming() const{
return incoming_;
}
//! Get Outgoing Function
/**
* @returns Outgoing Particles
*/
std::vector<HEJ::Particle> const & outgoing() const{
return outgoing_;
}
std::unordered_map<std::size_t, std::vector<HEJ::Particle>> const & decays() const{
return decays_;
}
//! Iterator to the first outgoing parton
ConstPartonIterator begin_partons() const;
//! Iterator to the first outgoing parton
ConstPartonIterator cbegin_partons() const;
//! Iterator to the end of the outgoing partons
ConstPartonIterator end_partons() const;
//! Iterator to the end of the outgoing partons
ConstPartonIterator cend_partons() const;
//! Reverse Iterator to the first outgoing parton
ConstReversePartonIterator rbegin_partons() const;
//! Reverse Iterator to the first outgoing parton
ConstReversePartonIterator crbegin_partons() const;
//! Reverse Iterator to the first outgoing parton
ConstReversePartonIterator rend_partons() const;
//! Reverse Iterator to the first outgoing parton
ConstReversePartonIterator crend_partons() const;
private:
friend HEJ::Event::EventData to_EventData(PhaseSpacePoint psp);
/**
* @internal
* @brief Generate LO parton momentum
*
* @param count Number of partons to generate
* @param is_pure_jets If true ensures momentum conservation in x and y
* @param jet_param Jet properties to fulfil
* @param max_pt max allowed pt for a parton (typically E_CMS)
* @param ran Random Number Generator
*
* @returns Momentum of partons
*
* Ensures that each parton is in its own jet.
* Generation is independent of parton flavour. Output is sorted in rapidity.
*/
std::vector<fastjet::PseudoJet> gen_LO_partons(
int count, bool is_pure_jets,
JetParameters const & jet_param,
double max_pt,
HEJ::RNG & ran
);
HEJ::Particle gen_boson(
HEJ::ParticleID bosonid, double mass, double width,
HEJ::RNG & ran
);
template<class ParticleMomenta>
fastjet::PseudoJet gen_last_momentum(
ParticleMomenta const & other_momenta,
double mass_square, double y
) const;
bool jets_ok(
std::vector<fastjet::PseudoJet> const & Born_jets,
std::vector<fastjet::PseudoJet> const & partons
) const;
/**
* @internal
* @brief Generate incoming partons according to the PDF
*
* @param uf Scale used in the PDF
*/
void reconstruct_incoming(
Process const & proc,
double subl_chance, Subleading subl_channels,
HEJ::PDF & pdf, double E_beam,
double uf,
HEJ::RNG & ran
);
HEJ::ParticleID generate_incoming_id(
std::size_t beam_idx, double x, double uf, HEJ::PDF & pdf,
std::bitset<11> allowed_partons, HEJ::RNG & ran
);
//! @brief Returns list of all allowed initial states partons
std::array<std::bitset<11>,2> allowed_incoming(
Process const & proc,
double subl_chance, Subleading subl_channels,
HEJ::RNG & ran
);
//! Ensure that incoming state compatible with A/W/Z production
std::array<std::bitset<11>,2> incoming_AWZ(
Process const & proc, Subleading subl_channels,
std::array<std::bitset<11>,2> allowed_partons,
HEJ::RNG & ran
);
//! Ensure that incoming state compatible with extremal qqx
std::array<std::bitset<11>,2> incoming_eqqx(
std::array<std::bitset<11>,2> allowed_partons, HEJ::RNG & ran);
//! Ensure that incoming state compatible with unordered
std::array<std::bitset<11>,2> incoming_uno(
std::array<std::bitset<11>,2> allowed_partons, HEJ::RNG & ran);
bool momentum_conserved(double ep) const;
bool extremal_FKL_ok(
std::vector<fastjet::PseudoJet> const & partons
) const;
double random_normal(double stddev, HEJ::RNG & ran);
/**
* @internal
* @brief Turns a FKL configuration into a subleading one
*
* @param chance Chance to switch to subleading configuration
* @param channels Allowed channels for subleading process
* @param proc Process to decide which subleading
* configurations are allowed
*
* With a chance of "chance" the FKL configuration is either turned into
* a unordered configuration or, for A/W/Z bosons, a configuration with
* a central quark/anti-quark pair.
*/
void maybe_turn_to_subl(double chance, Subleading channels,
Process const & proc, HEJ::RNG & ran);
void turn_to_subl(
Subleading channels,
bool can_be_uno_backward, bool can_be_uno_forward, bool allow_strange,
HEJ::RNG & ran);
void turn_to_uno(bool can_be_uno_backward, bool can_be_uno_forward,
HEJ::RNG & ran);
HEJ::ParticleID select_qqx_flavour(bool allow_strange, HEJ::RNG & ran);
void turn_to_cqqx(bool allow_strange, HEJ::RNG & ran);
void turn_to_eqqx(bool allow_strange, HEJ::RNG & ran);
//! decay where we select the decay channel
std::vector<HEJ::Particle> decay_boson(
HEJ::Particle const & parent,
std::vector<Decay> const & decays,
HEJ::RNG & ran
);
//! generate decay products of a boson
std::vector<HEJ::Particle> decay_boson(
HEJ::Particle const & parent,
std::vector<HEJ::ParticleID> const & decays,
HEJ::RNG & ran
);
/// @brief setup outgoing partons to ensure correct coupling to boson
void couple_boson(HEJ::ParticleID boson, HEJ::RNG & ran);
Decay select_decay_channel(
std::vector<Decay> const & decays,
HEJ::RNG & ran
);
double gen_hard_pt(
int np, double ptmin, double ptmax, double y,
HEJ::RNG & ran
);
double gen_soft_pt(int np, double ptmax, HEJ::RNG & ran);
double gen_parton_pt(
int count, JetParameters const & jet_param, double ptmax, double y,
HEJ::RNG & ran
);
//! Iterator over partons (non-const)
using PartonIterator = boost::filter_iterator<
bool (*)(HEJ::Particle const &),
std::vector<HEJ::Particle>::iterator
>;
//! Reverse Iterator over partons (non-const)
using ReversePartonIterator = std::reverse_iterator<PartonIterator>;
//! Iterator to the first outgoing parton (non-const)
PartonIterator begin_partons();
//! Iterator to the end of the outgoing partons (non-const)
PartonIterator end_partons();
//! Reverse Iterator to the first outgoing parton (non-const)
ReversePartonIterator rbegin_partons();
//! Reverse Iterator to the first outgoing parton (non-const)
ReversePartonIterator rend_partons();
double weight_;
Status status_;
std::array<HEJ::Particle, 2> incoming_;
std::vector<HEJ::Particle> outgoing_;
//! Particle decays in the format {outgoing index, decay products}
std::unordered_map<std::size_t, std::vector<HEJ::Particle>> decays_;
};
//! Extract HEJ::Event::EventData from PhaseSpacePoint
HEJ::Event::EventData to_EventData(PhaseSpacePoint psp);
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, May 3, 5:37 AM (4 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4982779
Default Alt Text
(15 KB)
Attached To
rHEJ HEJ
Event Timeline
Log In to Comment