Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F7879479
D115.id496.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
56 KB
Subscribers
None
D115.id496.diff
View Options
diff --git a/.clang-format b/.clang-format
--- a/.clang-format
+++ b/.clang-format
@@ -66,7 +66,7 @@
Priority: 4
- Regex: '^"(HepMC|HepMC3)/'
Priority: 5
- - Regex: '^"(Pythia8|Photos|Tauola)/'
+ - Regex: '^"(Pythia8|Photos|Tauola|SHERPA|ATOOLS)/'
Priority: 6
- Regex: '^"T[[:alnum:]]+\.h"'
Priority: 7
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,6 +14,7 @@
USE_PYTHIA: "ON"
USE_PHOTOS: "ON"
USE_TAUOLA: "ON"
+ USE_SHERPA: "ON"
.future_os_image:
variables:
@@ -49,7 +50,7 @@
script:
- mkdir install
- mkdir build && cd build
- - cmake -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/install -DEVTGEN_HEPMC3:BOOL=$USE_HEPMC3 -DEVTGEN_PYTHIA:BOOL=$USE_PYTHIA -DEVTGEN_PHOTOS:BOOL=$USE_PHOTOS -DEVTGEN_TAUOLA:BOOL=$USE_TAUOLA -DEVTGEN_BUILD_TESTS:BOOL=$BUILD_TESTS -DEVTGEN_BUILD_VALIDATIONS:BOOL=$BUILD_TESTS -DEVTGEN_BUILD_DOXYGEN:BOOL=$BUILD_DOXYGEN $CI_PROJECT_DIR
+ - cmake -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX:PATH=$CI_PROJECT_DIR/install -DEVTGEN_HEPMC3:BOOL=$USE_HEPMC3 -DEVTGEN_PYTHIA:BOOL=$USE_PYTHIA -DEVTGEN_PHOTOS:BOOL=$USE_PHOTOS -DEVTGEN_TAUOLA:BOOL=$USE_TAUOLA -DEVTGEN_SHERPA:BOOL=$USE_SHERPA -DEVTGEN_BUILD_TESTS:BOOL=$BUILD_TESTS -DEVTGEN_BUILD_VALIDATIONS:BOOL=$BUILD_TESTS -DEVTGEN_BUILD_DOXYGEN:BOOL=$BUILD_DOXYGEN $CI_PROJECT_DIR
- cmake --build .
- cmake --build . --target install
@@ -82,7 +83,7 @@
- .check_template
script:
- mkdir build && cd build
- - cmake -DEVTGEN_HEPMC3:BOOL=ON -DEVTGEN_PYTHIA:BOOL=ON -DEVTGEN_PHOTOS:BOOL=ON -DEVTGEN_TAUOLA:BOOL=ON -DEVTGEN_BUILD_TESTS:BOOL=OFF -DEVTGEN_BUILD_DOXYGEN:BOOL=ON $CI_PROJECT_DIR
+ - cmake -DEVTGEN_HEPMC3:BOOL=ON -DEVTGEN_PYTHIA:BOOL=ON -DEVTGEN_PHOTOS:BOOL=ON -DEVTGEN_TAUOLA:BOOL=ON -DEVTGEN_SHERPA:BOOL=ON -DEVTGEN_BUILD_TESTS:BOOL=OFF -DEVTGEN_BUILD_DOXYGEN:BOOL=ON $CI_PROJECT_DIR
- cmake --build . --target doc
- curl -o renameMemberVars.py "https://gitlab.cern.ch/evtgen/utilities/raw/master/RenameMemberVars/renameMemberVars.py?inline=false"
- python renameMemberVars.py check $CI_PROJECT_DIR doxygen/html
@@ -106,6 +107,7 @@
LCG_VERSION: "LCG_103_LHCB_7"
LCG_COMPILER: "gcc$GCC_VERSION-opt"
USE_HEPMC3: "OFF"
+ USE_SHERPA: "OFF"
extends:
- .production_image
- .build_template
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,6 +64,7 @@
option(EVTGEN_PYTHIA "Enable/disable linking with Pythia8" OFF)
option(EVTGEN_PHOTOS "Enable/disable linking with Photos++" OFF)
option(EVTGEN_TAUOLA "Enable/disable linking with Tauola++" OFF)
+option(EVTGEN_SHERPA "Enable/disable linking with Sherpa" OFF)
option(EVTGEN_SUPPRESS_EXTERNAL_WARNINGS "Enable/disable suppression of warnings from external dependencies" OFF)
if (EVTGEN_HEPMC3)
message(STATUS "EvtGen: Linking with HepMC3")
@@ -74,6 +75,7 @@
message(STATUS "EvtGen: Optional linking with Pythia8 EVTGEN_PYTHIA ${EVTGEN_PYTHIA}")
message(STATUS "EvtGen: Optional linking with Photos++ EVTGEN_PHOTOS ${EVTGEN_PHOTOS}")
message(STATUS "EvtGen: Optional linking with Tauola++ EVTGEN_TAUOLA ${EVTGEN_TAUOLA}")
+message(STATUS "EvtGen: Optional linking with Sherpa EVTGEN_SHERPA ${EVTGEN_SHERPA}")
include(EvtGenExternalDependencies)
# Setup clang-tidy checks
diff --git a/EvtGenExternal/EvtExternalGenList.hh b/EvtGenExternal/EvtExternalGenList.hh
--- a/EvtGenExternal/EvtExternalGenList.hh
+++ b/EvtGenExternal/EvtExternalGenList.hh
@@ -43,6 +43,10 @@
EvtAbsRadCorr* getPhotosModel( const double infraredCutOff = 1.0e-7,
const double maxWtInterference = 64.0 );
+ EvtAbsRadCorr* getSherpaPhotonsModel( const double infraredCutOff = 1.0e-7,
+ const int mode = 2,
+ const int useME = 0 );
+
protected:
private:
std::string m_photonType;
diff --git a/EvtGenExternal/EvtSherpaPhotons.hh b/EvtGenExternal/EvtSherpaPhotons.hh
new file mode 100644
--- /dev/null
+++ b/EvtGenExternal/EvtSherpaPhotons.hh
@@ -0,0 +1,86 @@
+
+/***********************************************************************
+* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
+* *
+* This file is part of EvtGen. *
+* *
+* EvtGen is free software: you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* EvtGen is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
+***********************************************************************/
+
+#ifdef EVTGEN_SHERPA
+#ifndef EVTSHERPAPHOTONS_HH
+#define EVTSHERPAPHOTONS_HH
+
+#include "EvtGenBase/EvtAbsRadCorr.hh"
+#include "EvtGenBase/EvtHepMCEvent.hh"
+#include "EvtGenBase/EvtId.hh"
+#include "EvtGenBase/EvtPDL.hh"
+#include "EvtGenBase/EvtParticle.hh"
+
+#include "SHERPA/Main/Sherpa.H"
+
+#include <string>
+
+class EvtParticle;
+class EvtAbsExternalGen;
+
+/* Description: EvtGen's interface to PHOTOS for generation of
+ * QED final state radiation.
+ */
+class EvtSherpaPhotons : public EvtAbsRadCorr {
+ public:
+ EvtSherpaPhotons( const bool useEvtGenRandom = true,
+ const double infraredCutOff = 1.0e-7, const int mode = 2,
+ const int useME = 0 );
+
+ void initialise() override;
+
+ void doRadCorr( EvtParticle* p ) override;
+
+ private:
+ // Provides vector of pointers to the configuration strings for Sherpa
+ std::vector<char*> addParameters();
+
+ // Updates the particle properties table of Sherpa
+ void updateParticleLists();
+
+ // The Sherpa instance.
+ std::unique_ptr<SHERPA::Sherpa> m_sherpaGen;
+
+ // Vector containing the configuration strings for Sherpa
+ // INIT_ONLY=6 intialises the Sherpa objects without launching simulation.
+ std::vector<std::string> m_configs{ "Sherpa", "INIT_ONLY=6" };
+
+ // Use EvtGen's random number generator
+ bool m_useEvtGenRandom = true;
+
+ // Default settings for PHOTONS++
+ // Minimum photon Energy (infrared cut-off).
+ double m_infraredCutOff = 1.0e-7;
+ // Switches on (default) the hard emission corrections (mode 2),
+ // otherwise follow the soft-photon only approach (mode 1).
+ int m_mode = 2;
+ // Switches off (default) or on the exact matrix-element corrections (works only for mode 2)
+ int m_useME = 0;
+
+ // Default photon properties
+ const std::string m_photonType = "gamma";
+ EvtId m_gammaId = EvtId( -1, -1 );
+ long int m_gammaPDG = 22;
+ bool m_initialised = false;
+};
+
+#endif
+
+#endif
diff --git a/EvtGenExternal/EvtSherpaRandom.hh b/EvtGenExternal/EvtSherpaRandom.hh
new file mode 100644
--- /dev/null
+++ b/EvtGenExternal/EvtSherpaRandom.hh
@@ -0,0 +1,94 @@
+
+/***********************************************************************
+* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
+* *
+* This file is part of EvtGen. *
+* *
+* EvtGen is free software: you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* EvtGen is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
+***********************************************************************/
+
+#ifdef EVTGEN_SHERPA
+
+#ifndef EVTSHERPARANDOM_HH
+#define EVTSHERPARANDOM_HH
+
+#include "EvtGenBase/EvtRandom.hh"
+
+#include "ATOOLS/Math/Random.H"
+
+/* Description: Class to specify the chosen EvtGen random number (engine)
+ * to be used for Sherpa.
+ */
+
+class EvtSherpaRandom : public ATOOLS::External_RNG {
+ public:
+ double Get() { return EvtRandom::Flat(); }
+
+ private:
+};
+
+// The following code makes EvtSherpaRandom loadable in Sherpa
+
+//! \cond DOXYGEN_IGNORE
+
+// In Sherpa versions v2.2.15 and earlier the DECLARE_GETTER macro produces code that doesn't compile with gcc versions > 12 and C++20
+// So, in those cases, instead use explicit code that has been modified to work correctly
+#ifdef EVTGEN_SHERPA_USEMACRO
+DECLARE_GETTER( EvtSherpaRandom, "EvtSherpaRandom", ATOOLS::External_RNG,
+ ATOOLS::RNG_Key );
+#else
+namespace ATOOLS {
+ template <>
+ class Getter<External_RNG, RNG_Key, EvtSherpaRandom> :
+ public Getter_Function<External_RNG, RNG_Key> {
+ public:
+ Getter( const bool& d = true ) :
+ Getter_Function<External_RNG, RNG_Key>{ "EvtSherpaRandom" }
+ {
+ SetDisplay( d );
+ }
+
+ protected:
+ void PrintInfo( std::ostream& str, const size_t width ) const;
+ Object_Type* operator()( const Parameter_Type& parameters ) const;
+
+ private:
+ static Getter<External_RNG, RNG_Key, EvtSherpaRandom> s_initializer;
+ };
+} // namespace ATOOLS
+
+ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>
+ ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>::s_initializer{
+ true };
+#endif
+
+ATOOLS::External_RNG*
+ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>::operator()(
+ const ATOOLS::RNG_Key& ) const
+{
+ return new EvtSherpaRandom();
+}
+
+// This eventually prints a help message
+void ATOOLS::Getter<ATOOLS::External_RNG, ATOOLS::RNG_Key, EvtSherpaRandom>::PrintInfo(
+ std::ostream& str, const size_t ) const
+{
+ str << " EvtGen-Sherpa RNG interface";
+}
+
+//! \endcond
+
+#endif
+
+#endif
diff --git a/History.md b/History.md
--- a/History.md
+++ b/History.md
@@ -11,8 +11,16 @@
===
## R02-0X-00
+21 May 2024 Fernando Abudinen
+* D115: Introduced Sherpa's PHOTONS++ generator
+ as alternative for final-state radiation simulation.
+ - Added Sherpa dependencies and linking in compilation files
+ - Introduced new `EvtSherpaPhotons` interface
+ - Introduced new `EvtSherpaRandom` interface to propagate EvtGen's random number into Sherpa
+ - Implemented `fsrGenerator` as input argument in `testDecayModel` module
+
8 May 2024 Michal Kreps, Thomas Latham, Andrii Verbytskyi
-* D58: Rename member variables to follow convention of m_ prefix
+* D58: Rename member variables to follow convention of `m_` prefix
- In addition:
* Introduce pre-build check in the CI that convention is being followed in all classes
* Fix shadowing of variables in some classes
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -23,14 +23,16 @@
We now recommend using HepMC3 but support for HepMC2 continues to be available.
Optionally, it is possible to use other external generators, such as Pythia8
-(for Pythia decays in the DECAY.DEC file, for example), Photos (for
-radiative corrections) and Tauola (for tau decays):
+(for Pythia decays in the DECAY.DEC file, for example), Photos or Sherpa's Photons++
+(for radiative corrections) and Tauola (for tau decays):
Pythia8 https://pythia.org/
-Photos http://photospp.web.cern.ch/photospp/
+Photos https://photospp.web.cern.ch/
-Tauola http://tauolapp.web.cern.ch/tauolapp/
+Tauola https://tauolapp.web.cern.ch/
+
+Sherpa https://sherpa-team.gitlab.io/
All of these packages have instructions for building them.
@@ -38,6 +40,7 @@
Pythia8: 8.201 or newer
Photos: 3.64 or newer
Tauola: 1.1.8 or newer
+Sherpa: 2.0.0 or newer
Once these packages are available, build the EvtGen release by creating a build directory
alongside the EvtGen source directory (assumed here to be called evtgen.git) and running:
@@ -88,6 +91,13 @@
depending on your build environment, otherwise the
location can be specified via this option.
+ `-DEVTGEN_SHERPA=ON` : Enable linking with Sherpa (OFF by default)
+
+ `-DSHERPA_ROOT_DIR=<location>` : Location of Sherpa install directory
+ As with HepMC this may be automatically detected
+ depending on your build environment, otherwise the
+ location can be specified via this option.
+
`-DEVTGEN_BUILD_DOC=ON` : Enable building documentation in 'doc' directory (OFF by default)
`-DEVTGEN_BUILD_TESTS=ON` : Enable building executables in 'test' directory (OFF by default)
@@ -168,23 +178,26 @@
To use the external generators, use the following code:
```c++
- #include "EvtGenExternal/EvtExternalGenList.hh"
#include "EvtGenBase/EvtAbsRadCorr.hh"
#include "EvtGenBase/EvtDecayBase.hh"
+ #include "EvtGenExternal/EvtExternalGenList.hh"
+
// Set up the default external generator list: Photos, Pythia and/or Tauola
EvtExternalGenList genList;
EvtAbsRadCorr* radCorrEngine = genList.getPhotosModel();
std::list<EvtDecayBase*> extraModels = genList.getListOfModels();
// Create the EvtGen generator object
- EvtGen myGenerator("decayFile.dec", "evt.pdl", randomEnginePointer,
- radCorrEngine, &extraModels);
+ EvtGen myGenerator( "decayFile.dec", "evt.pdl", randomEnginePointer,
+ radCorrEngine, &extraModels );
//If you don't want to use external generators, use the following:
//EvtGen myGenerator("decayFile.dec", "evt.pdl", randomEnginePointer);
```
+ To use Sherpa's PHOTONS++ generator instead of Photos, replace above `getPhotosModel()` with `getSherpaPhotonsModel()`.
+
The files [Pythia8_README.md](Pythia8_README.md) and [Tauola_README.md](Tauola_README.md) have more details about
using the new Pythia 8 and Tauola generators (called via the PYTHIA and TAUOLA
"decay.dec" model names). The new Photos generator is still called via the PHOTOS
@@ -193,7 +206,7 @@
It is now possible to use alias particle decays for the Pythia 8 model.
Two Pythia 8 instances are used in EvtPythiaEngine for normal and aliased decays.
Since the underlying code for Photos and Tauola is still Fortran, it is only
- possible to have one (unique) instance of each of these external generators.
+ possible to have one unique instance of each of these external generators.
This can only be fixed if these packages are converted to pure C++ code.
@@ -206,7 +219,6 @@
(EvtGenModels/EvtGenericDalitz.cpp), that should be used instead of EvtDDalitz.
The generic Dalitz model uses xml files to configure the resonance amplitude
parameters (instead of being hardcoded in EvtDDalitz):
-
```
Decay D+
1.0 K- pi+ pi+ GENERIC_DALITZ MyDalitzParameters.xml;
@@ -229,5 +241,3 @@
One or the other can be chosen as the mixing method for the B system by
choosing 0 (coherent) or 1 (incoherent) for the last integer argument
in the EvtGen() constructor.
-
-
diff --git a/cmake/Modules/EvtGenCompilerFlags.cmake b/cmake/Modules/EvtGenCompilerFlags.cmake
--- a/cmake/Modules/EvtGenCompilerFlags.cmake
+++ b/cmake/Modules/EvtGenCompilerFlags.cmake
@@ -35,6 +35,8 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsigned-char -Wall -Wextra -Wshadow -Woverloaded-virtual")
if( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" )
+ # Save temporary intermediate compilation products, e.g. result of pre-processor, etc.
+ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -save-temps=obj")
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g3")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
diff --git a/cmake/Modules/EvtGenExternalDependencies.cmake b/cmake/Modules/EvtGenExternalDependencies.cmake
--- a/cmake/Modules/EvtGenExternalDependencies.cmake
+++ b/cmake/Modules/EvtGenExternalDependencies.cmake
@@ -27,6 +27,7 @@
set(Tauola++_ROOT_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Location of Tauola++ installation")
set(PHOTOSPP_ROOT_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Location of Photos++ installation - alternative spelling")
set(TAUOLAPP_ROOT_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Location of Tauola++ installation - alternative spelling")
+set(SHERPA_ROOT_DIR "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Location of Sherpa installation")
# The components we search for in the external generators depend on the version
# of HepMC we're working with
@@ -43,6 +44,9 @@
# From version 1.1.8 Tauola has HepMC3 support
find_package(Tauola++ REQUIRED COMPONENTS Fortran CxxInterface HepMC3)
endif()
+ if(EVTGEN_SHERPA)
+ find_package(Sherpa 2.0.0 REQUIRED)
+ endif()
else()
find_package(HepMC2 REQUIRED)
if(EVTGEN_PYTHIA)
@@ -57,4 +61,7 @@
# Older versions of Tauola don't have the HepMC component, the HepMC2 interface is in CxxInterface
find_package(Tauola++ REQUIRED COMPONENTS Fortran CxxInterface OPTIONAL_COMPONENTS HepMC)
endif()
+ if(EVTGEN_SHERPA)
+ find_package(Sherpa 2.0.0 REQUIRED)
+ endif()
endif()
diff --git a/cmake/Modules/FindPythia8.cmake b/cmake/Modules/FindPythia8.cmake
--- a/cmake/Modules/FindPythia8.cmake
+++ b/cmake/Modules/FindPythia8.cmake
@@ -41,7 +41,7 @@
if(PYTHIA8_XML AND NOT PYTHIA8_VERSION)
file(READ ${PYTHIA8_XML}/Version.xml versionstr)
string(REGEX REPLACE ".*Pythia:versionNumber.*default.*[0-9][.]([0-9]+).*" "\\1" PYTHIA8_VERSION "${versionstr}")
- set(PYTHIA8_VERSION ${PYTHIA8_VERSION} CACHE STRING "Detected version of Pythia8.")
+ set(PYTHIA8_VERSION ${PYTHIA8_VERSION} CACHE STRING "Detected version of Pythia8")
mark_as_advanced(PYTHIA8_VERSION)
endif()
@@ -76,7 +76,7 @@
# handle the QUIETLY and REQUIRED arguments and set PYTHIA8_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pythia8 DEFAULT_MSG PYTHIA8_INCLUDE_DIR PYTHIA8_LIBRARIES PYTHIA8_XML)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pythia8 DEFAULT_MSG PYTHIA8_VERSION PYTHIA8_INCLUDE_DIR PYTHIA8_LIBRARIES PYTHIA8_XML)
set(PYTHIA8_INCLUDE_DIRS ${PYTHIA8_INCLUDE_DIR})
diff --git a/cmake/Modules/FindSherpa.cmake b/cmake/Modules/FindSherpa.cmake
new file mode 100644
--- /dev/null
+++ b/cmake/Modules/FindSherpa.cmake
@@ -0,0 +1,81 @@
+
+########################################################################
+# Copyright 1998-2020 CERN for the benefit of the EvtGen authors #
+# #
+# This file is part of EvtGen. #
+# #
+# EvtGen is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# EvtGen is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with EvtGen. If not, see <https://www.gnu.org/licenses/>. #
+########################################################################
+
+# - Try to find Sherpa
+# Defines:
+#
+# SHERPA_FOUND
+# SHERPA_VERSION
+# SHERPA_INCLUDE_DIR
+# SHERPA_INCLUDE_DIRS (not cached)
+# SHERPA_LIBRARY
+# SHERPA_LIBRARIES (not cached)
+# SHERPA_LIBRARY_DIRS (not cached)
+
+find_path(SHERPA_INCLUDE_DIR SHERPA/Main/Sherpa.H
+ HINTS $ENV{SHERPA_ROOT_DIR}/include ${SHERPA_ROOT_DIR}/include
+ PATH_SUFFIXES include SHERPA-MC)
+
+mark_as_advanced(SHERPA_INCLUDE_DIR)
+
+# Enforce a minimal list if none is explicitly requested
+if(NOT Sherpa_FIND_COMPONENTS)
+ set(Sherpa_FIND_COMPONENTS SherpaMain ModelMain METoolsMain METoolsLoops METoolsSpinCorrelations PDF PhotonsMEs PhotonsMain PhotonsPhaseSpace PhotonsTools Remnant ToolsMath ToolsOrg ToolsPhys)
+endif()
+
+foreach(component ${Sherpa_FIND_COMPONENTS})
+ find_library(SHERPA_${component}_LIBRARY NAMES ${component} ${_${component}_names}
+ HINTS $ENV{SHERPA_ROOT_DIR}/lib ${SHERPA_ROOT_DIR}/lib $ENV{SHERPA_ROOT_DIR}/lib64 ${SHERPA_ROOT_DIR}/lib64
+ PATH_SUFFIXES SHERPA-MC)
+ if (SHERPA_${component}_LIBRARY)
+ set(SHERPA_${component}_FOUND 1)
+ list(APPEND SHERPA_LIBRARIES ${SHERPA_${component}_LIBRARY})
+
+ get_filename_component(libdir ${SHERPA_${component}_LIBRARY} PATH)
+ list(APPEND SHERPA_LIBRARY_DIRS ${libdir})
+ else()
+ set(SHERPA_${component}_FOUND 0)
+ endif()
+ mark_as_advanced(SHERPA_${component}_LIBRARY)
+endforeach()
+
+if(SHERPA_LIBRARY_DIRS)
+ list(REMOVE_DUPLICATES SHERPA_LIBRARY_DIRS)
+endif()
+
+find_program(SHERPA_CONFIG Sherpa-config
+ HINTS $ENV{SHERPA_ROOT_DIR}/bin ${SHERPA_ROOT_DIR}/bin)
+
+if(SHERPA_CONFIG)
+ execute_process(COMMAND ${SHERPA_CONFIG} --version
+ OUTPUT_VARIABLE SHERPA_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set(SHERPA_VERSION ${SHERPA_VERSION} CACHE STRING "Detected version of Sherpa")
+ mark_as_advanced(SHERPA_VERSION)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set SHERPA_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sherpa DEFAULT_MSG SHERPA_VERSION SHERPA_INCLUDE_DIR SHERPA_LIBRARIES )
+
+set(SHERPA_INCLUDE_DIRS ${SHERPA_INCLUDE_DIR})
+
+mark_as_advanced(SHERPA_FOUND)
diff --git a/doxygen/Doxyfile.in b/doxygen/Doxyfile.in
--- a/doxygen/Doxyfile.in
+++ b/doxygen/Doxyfile.in
@@ -2059,7 +2059,7 @@
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED = EVTGEN_HEPMC3 EVTGEN_PYTHIA EVTGEN_PHOTOS EVTGEN_TAUOLA
+PREDEFINED = EVTGEN_HEPMC3 EVTGEN_PYTHIA EVTGEN_PHOTOS EVTGEN_TAUOLA EVTGEN_SHERPA
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
diff --git a/setupEvtGen.sh b/setupEvtGen.sh
--- a/setupEvtGen.sh
+++ b/setupEvtGen.sh
@@ -41,35 +41,64 @@
# Location in which to install
INSTALL_PREFIX="/usr/local"
-# EvtGen version or tag number (or branch name). No extra spaces on this line!
-VERSION=R02-02-00
+# EvtGen version or tag number (or branch name)
+VERSION="R02-02-00"
+
+# EvtGen git URL
+# HepForge main repo
+EVTGEN_URL="https://phab.hepforge.org/source/evtgen.git"
+# CERN GitLab mirror
+#EVTGEN_URL="https://gitlab.cern.ch/evtgen/evtgen.git"
+
+# Options to pass to 'make', e.g. "-j 6"
+BUILDARGS=""
# HepMC version numbers - change HEPMCMAJORVERSION to 2 in order to use HepMC2
HEPMCMAJORVERSION="3"
HEPMC2VER="2.06.10"
HEPMC3VER="3.2.6"
-HEPMC2PKG="HepMC-"$HEPMC2VER
-HEPMC3PKG="HepMC3-"$HEPMC3VER
-HEPMC2TAR="hepmc"$HEPMC2VER".tgz"
-HEPMC3TAR=$HEPMC3PKG".tar.gz"
+HEPMC2PKG="HepMC-$HEPMC2VER"
+HEPMC3PKG="HepMC3-$HEPMC3VER"
+HEPMC2TAR="hepmc$HEPMC2VER.tgz"
+HEPMC3TAR="$HEPMC3PKG.tar.gz"
+HEPMCBASEURL="http://hepmc.web.cern.ch/hepmc/releases"
+if [ "$HEPMCMAJORVERSION" -lt "3" ]
+then
+ HEPMCURL=$HEPMCBASEURL/$HEPMC2TAR
+else
+ HEPMCURL=$HEPMCBASEURL/$HEPMC3TAR
+fi
-# Pythia version number with no decimal points, e.g. 8230 corresponds to version 8.230. This
-# follows the naming convention of Pythia install tar files. Again, no extra spaces allowed.
-PYTHIAVER=8310
-PYTHIAPKG="pythia"$PYTHIAVER
-PYTHIATAR=$PYTHIAPKG".tgz"
+# Pythia version number with no decimal points, e.g. 8310 corresponds to version 8.310
+# This follows the naming convention of Pythia install tar files
+PYTHIAVER="8310"
+PYTHIAPKG="pythia$PYTHIAVER"
+PYTHIATAR="$PYTHIAPKG.tgz"
+PYTHIABASEURL="https://pythia.org/download"
+PYTHIAURL="$PYTHIABASEURL/pythia${PYTHIAVER:0:2}/$PYTHIATAR"
# Photos++ version number
PHOTOSVER="3.64"
PHOTOSPKG="PHOTOS"
-PHOTOSDIR="PHOTOS."$PHOTOSVER
-PHOTOSTAR=$PHOTOSDIR".tar.gz"
+PHOTOSDIR="PHOTOS.$PHOTOSVER"
+PHOTOSTAR="$PHOTOSDIR.tar.gz"
+PHOTOSBASEURL="https://photospp.web.cern.ch/resources"
+PHOTOSURL="$PHOTOSBASEURL/$PHOTOSDIR/$PHOTOSTAR"
# Tauola++ version number
TAUOLAVER="1.1.8"
TAUOLAPKG="TAUOLA"
-TAUOLADIR="TAUOLA."$TAUOLAVER
-TAUOLATAR=$TAUOLADIR".tar.gz"
+TAUOLADIR="TAUOLA.$TAUOLAVER"
+TAUOLATAR="$TAUOLADIR.tar.gz"
+TAUOLABASEURL="https://tauolapp.web.cern.ch/resources"
+TAUOLAURL="$TAUOLABASEURL/$TAUOLADIR/$TAUOLATAR"
+
+# Sherpa version number
+SHERPAVER="2.2.15"
+SHERPAPKG="sherpa-v$SHERPAVER"
+SHERPATAR="$SHERPAPKG.tar.gz"
+SHERPABASEURL="https://gitlab.com/sherpa-team/sherpa/-/archive"
+SHERPAURL="$SHERPABASEURL/v$SHERPAVER/$SHERPATAR"
# Determine OS
osArch=`uname`
@@ -106,10 +135,10 @@
mkdir -p sources
mkdir -p builds
-echo Downloading EvtGen source from GIT
+echo Downloading EvtGen source from GIT, using URL: $EVTGEN_URL
cd sources
-git clone https://phab.hepforge.org/source/evtgen.git evtgen
+git clone $EVTGEN_URL evtgen
cd evtgen
git checkout $VERSION
@@ -123,15 +152,16 @@
export LC_ALL=en_US.UTF-8
fi
-if [ "$HEPMCMAJORVERSION" -lt "3" ]
-then
- curl -O http://hepmc.web.cern.ch/hepmc/releases/$HEPMC2TAR
-else
- curl -O http://hepmc.web.cern.ch/hepmc/releases/$HEPMC3TAR
-fi
-curl -O https://pythia.org/download/pythia${PYTHIAVER:0:2}/$PYTHIATAR
-curl -O http://photospp.web.cern.ch/photospp/resources/$PHOTOSDIR/$PHOTOSTAR
-curl -O http://tauolapp.web.cern.ch/tauolapp/resources/$TAUOLADIR/$TAUOLATAR
+echo Downloading HepMC source from: $HEPMCURL
+curl -O $HEPMCURL
+echo Downloading Pythia8 source from: $PYTHIAURL
+curl -O $PYTHIAURL
+echo Downloading Photos source from: $PHOTOSURL
+curl -O $PHOTOSURL
+echo Downloading Tauola source from: $TAUOLAURL
+curl -O $TAUOLAURL
+echo Downloading Sherpa source from: $SHERPAURL
+curl -O $SHERPAURL
cd $BUILD_BASE/sources
@@ -145,6 +175,7 @@
tar -xzf $BUILD_BASE/tarfiles/$PYTHIATAR
tar -xzf $BUILD_BASE/tarfiles/$PHOTOSTAR
tar -xzf $BUILD_BASE/tarfiles/$TAUOLATAR
+tar -xzf $BUILD_BASE/tarfiles/$SHERPATAR
# Patch TAUOLA and PHOTOS on Darwin (Mac)
if [ "$osArch" == "Darwin" ]
@@ -168,19 +199,19 @@
mkdir -p $BUILD_BASE/builds/HepMC2
cd $BUILD_BASE/builds/HepMC2
$CMAKE -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX $BUILD_BASE/sources/$HEPMC2PKG -Dmomentum:STRING=GEV -Dlength:STRING=MM
- make
+ make $BUILDARGS
make install
echo Installing pythia8 from $BUILD_BASE/sources/$PYTHIAPKG
cd $BUILD_BASE/sources/$PYTHIAPKG
./configure --enable-shared --prefix=$INSTALL_PREFIX
- make
+ make $BUILDARGS
make install
echo Installing PHOTOS from $BUILD_BASE/sources/$PHOTOSPKG
cd $BUILD_BASE/sources/$PHOTOSPKG
./configure --with-hepmc3= --with-hepmc=$INSTALL_PREFIX --prefix=$INSTALL_PREFIX
- make
+ make $BUILDARGS
make install
if [ "$osArch" != "Darwin" ]
@@ -188,29 +219,28 @@
echo Installing TAUOLA from $BUILD_BASE/sources/$TAUOLAPKG
cd $BUILD_BASE/sources/$TAUOLAPKG
./configure --without-hepmc3 --with-hepmc=$INSTALL_PREFIX --prefix=$INSTALL_PREFIX
- make
+ make $BUILDARGS
make install
fi
-
else
echo Installing HepMC3 from $BUILD_BASE/sources/$HEPMC3PKG
mkdir -p $BUILD_BASE/builds/HepMC3
cd $BUILD_BASE/builds/HepMC3
$CMAKE -DHEPMC3_ENABLE_ROOTIO:BOOL=OFF -DHEPMC3_ENABLE_PYTHON:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX $BUILD_BASE/sources/$HEPMC3PKG
- make
+ make $BUILDARGS
make install
echo Installing pythia8 from $BUILD_BASE/souces/$PYTHIAPKG
cd $BUILD_BASE/sources/$PYTHIAPKG
./configure --enable-shared --prefix=$INSTALL_PREFIX
- make
+ make $BUILDARGS
make install
echo Installing PHOTOS from $BUILD_BASE/sources/$PHOTOSPKG
cd $BUILD_BASE/sources/$PHOTOSPKG
./configure --without-hepmc --with-hepmc3=$INSTALL_PREFIX --prefix=$INSTALL_PREFIX
- make
+ make $BUILDARGS
make install
if [ "$osArch" != "Darwin" ]
@@ -218,11 +248,18 @@
echo Installing TAUOLA from $BUILD_BASE/sources/$TAUOLAPKG
cd $BUILD_BASE/sources/$TAUOLAPKG
./configure --without-hepmc --with-hepmc3=$INSTALL_PREFIX --prefix=$INSTALL_PREFIX
- make
+ make $BUILDARGS
make install
fi
fi
+echo Installing Sherpa from $BUILD_BASE/sources/$SHERPAPKG
+cd $BUILD_BASE/sources/$SHERPAPKG
+autoreconf -i
+./configure --with-sqlite3=install --prefix=$INSTALL_PREFIX
+make $BUILDARGS
+make install
+
echo Installing EvtGen from $BUILD_BASE/sources/evtgen
mkdir -p $BUILD_BASE/builds/evtgen
cd $BUILD_BASE/builds/evtgen
@@ -234,13 +271,15 @@
-DEVTGEN_HEPMC3:BOOL=OFF -DHEPMC2_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PYTHIA:BOOL=ON -DPYTHIA8_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PHOTOS:BOOL=ON -DPHOTOSPP_ROOT_DIR:PATH=$INSTALL_PREFIX \
- -DEVTGEN_TAUOLA:BOOL=OFF
+ -DEVTGEN_TAUOLA:BOOL=OFF \
+ -DEVTGEN_SHERPA:BOOL=ON -DSHERPA_ROOT_DIR:PATH=$INSTALL_PREFIX
else
$CMAKE -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX $BUILD_BASE/sources/evtgen \
-DEVTGEN_HEPMC3:BOOL=ON -DHEPMC3_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PYTHIA:BOOL=ON -DPYTHIA8_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PHOTOS:BOOL=ON -DPHOTOSPP_ROOT_DIR:PATH=$INSTALL_PREFIX \
- -DEVTGEN_TAUOLA:BOOL=OFF
+ -DEVTGEN_TAUOLA:BOOL=OFF \
+ -DEVTGEN_SHERPA:BOOL=ON -DSHERPA_ROOT_DIR:PATH=$INSTALL_PREFIX
fi
else
if [ "$HEPMCMAJORVERSION" -lt "3" ]
@@ -249,16 +288,18 @@
-DEVTGEN_HEPMC3:BOOL=OFF -DHEPMC2_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PYTHIA:BOOL=ON -DPYTHIA8_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PHOTOS:BOOL=ON -DPHOTOSPP_ROOT_DIR:PATH=$INSTALL_PREFIX \
- -DEVTGEN_TAUOLA:BOOL=ON -DTAUOLAPP_ROOT_DIR:PATH=$INSTALL_PREFIX
+ -DEVTGEN_TAUOLA:BOOL=ON -DTAUOLAPP_ROOT_DIR:PATH=$INSTALL_PREFIX \
+ -DEVTGEN_SHERPA:BOOL=ON -DSHERPA_ROOT_DIR:PATH=$INSTALL_PREFIX
else
$CMAKE -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX $BUILD_BASE/sources/evtgen \
-DEVTGEN_HEPMC3:BOOL=ON -DHEPMC3_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PYTHIA:BOOL=ON -DPYTHIA8_ROOT_DIR:PATH=$INSTALL_PREFIX \
-DEVTGEN_PHOTOS:BOOL=ON -DPHOTOSPP_ROOT_DIR:PATH=$INSTALL_PREFIX \
- -DEVTGEN_TAUOLA:BOOL=ON -DTAUOLAPP_ROOT_DIR:PATH=$INSTALL_PREFIX
+ -DEVTGEN_TAUOLA:BOOL=ON -DTAUOLAPP_ROOT_DIR:PATH=$INSTALL_PREFIX \
+ -DEVTGEN_SHERPA:BOOL=ON -DSHERPA_ROOT_DIR:PATH=$INSTALL_PREFIX
fi
fi
-make
+make $BUILDARGS
make install
echo Setup done.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -83,7 +83,7 @@
# Add the EvtGenExternal library (if required)...
-if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA )
+if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA OR EVTGEN_SHERPA)
# Again, first build all the object files (with PIC enabled) so they can be
# used to build both the shared and static libs
add_library(objlib_ext OBJECT ${EVTGEN_EXTERNAL_SOURCES})
@@ -130,6 +130,17 @@
target_include_directories(objlib_ext PRIVATE ${Tauola++_INCLUDE_DIRS})
endif()
endif()
+ if(EVTGEN_SHERPA)
+ target_compile_definitions(objlib_ext PRIVATE EVTGEN_SHERPA)
+ if( ${SHERPA_VERSION} VERSION_GREATER 2.2.15 )
+ target_compile_definitions(objlib_ext PRIVATE EVTGEN_SHERPA_USEMACRO)
+ endif()
+ if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS)
+ target_include_directories(objlib_ext SYSTEM PRIVATE ${SHERPA_INCLUDE_DIRS})
+ else()
+ target_include_directories(objlib_ext PRIVATE ${SHERPA_INCLUDE_DIRS})
+ endif()
+ endif()
# Now make the shared library from the object files
add_library(EvtGenExternal SHARED $<TARGET_OBJECTS:objlib_ext>)
@@ -142,6 +153,14 @@
target_include_directories(EvtGenExternal PUBLIC ${PYTHIA8_INCLUDE_DIRS})
target_link_libraries(EvtGenExternal PUBLIC ${PYTHIA8_LIBRARIES})
endif()
+ if(EVTGEN_SHERPA)
+ target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_SHERPA)
+ if( ${SHERPA_VERSION} VERSION_GREATER 2.2.15 )
+ target_compile_definitions(EvtGenExternal PRIVATE EVTGEN_SHERPA_USEMACRO)
+ endif()
+ target_include_directories(EvtGenExternal PUBLIC ${SHERPA_INCLUDE_DIRS})
+ target_link_libraries(EvtGenExternal PUBLIC ${SHERPA_LIBRARIES})
+ endif()
if(EVTGEN_HEPMC3)
target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_HEPMC3)
target_include_directories(EvtGenExternal PUBLIC ${HEPMC3_INCLUDE_DIR})
@@ -199,6 +218,14 @@
target_include_directories(EvtGenExternalStatic PUBLIC ${PYTHIA8_INCLUDE_DIRS})
target_link_libraries(EvtGenExternalStatic PUBLIC ${PYTHIA8_LIBRARIES})
endif()
+ if(EVTGEN_SHERPA)
+ target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_SHERPA)
+ if( ${SHERPA_VERSION} VERSION_GREATER 2.2.15 )
+ target_compile_definitions(EvtGenExternalStatic PRIVATE EVTGEN_SHERPA_USEMACRO)
+ endif()
+ target_include_directories(EvtGenExternalStatic PUBLIC ${SHERPA_INCLUDE_DIRS})
+ target_link_libraries(EvtGenExternalStatic PUBLIC ${SHERPA_LIBRARIES})
+ endif()
if(EVTGEN_HEPMC3)
target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_HEPMC3)
target_include_directories(EvtGenExternalStatic PUBLIC ${HEPMC3_INCLUDE_DIR})
@@ -255,7 +282,7 @@
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
-if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA )
+if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA OR EVTGEN_SHERPA)
install(
TARGETS EvtGenExternal EvtGenExternalStatic
EXPORT "EvtGenTargets"
diff --git a/src/EvtGenExternal/EvtExternalGenList.cpp b/src/EvtGenExternal/EvtExternalGenList.cpp
--- a/src/EvtGenExternal/EvtExternalGenList.cpp
+++ b/src/EvtGenExternal/EvtExternalGenList.cpp
@@ -25,6 +25,7 @@
#include "EvtGenExternal/EvtExternalGenFactory.hh"
#include "EvtGenExternal/EvtPHOTOS.hh"
#include "EvtGenExternal/EvtPythia.hh"
+#include "EvtGenExternal/EvtSherpaPhotons.hh"
#include "EvtGenExternal/EvtTauola.hh"
EvtExternalGenList::EvtExternalGenList( bool convertPythiaCodes,
@@ -80,6 +81,30 @@
}
#endif
+#ifdef EVTGEN_SHERPA
+EvtAbsRadCorr* EvtExternalGenList::getSherpaPhotonsModel(
+ const double infraredCutOff, const int mode, const int useME )
+{
+ // Define the Photos model, which uses the EvtSherpaPhotonsEngine class.
+ EvtSherpaPhotons* sherpaPhotonsModel =
+ new EvtSherpaPhotons( m_useEvtGenRandom, infraredCutOff, mode, useME );
+ return sherpaPhotonsModel;
+}
+#else
+EvtAbsRadCorr* EvtExternalGenList::getSherpaPhotonsModel(
+ const double /*infraredCutOff*/, const int /*mode*/, const int /*useME*/ )
+{
+ EvtGenReport( EVTGEN_ERROR, "EvtGen" )
+ << " Sherpa's PHOTONS++ generator has been called for FSR simulation, but Sherpa was not switched on during compilation."
+ << std::endl;
+
+ EvtGenReport( EVTGEN_ERROR, "EvtGen" )
+ << " The simulation will be generated without FSR." << std::endl;
+
+ return new EvtNoRadCorr{};
+}
+#endif
+
std::list<EvtDecayBase*> EvtExternalGenList::getListOfModels()
{
// Create the Pythia and Tauola models, which use their own engine classes.
diff --git a/src/EvtGenExternal/EvtSherpaPhotons.cpp b/src/EvtGenExternal/EvtSherpaPhotons.cpp
new file mode 100644
--- /dev/null
+++ b/src/EvtGenExternal/EvtSherpaPhotons.cpp
@@ -0,0 +1,299 @@
+
+/***********************************************************************
+* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
+* *
+* This file is part of EvtGen. *
+* *
+* EvtGen is free software: you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation, either version 3 of the License, or *
+* (at your option) any later version. *
+* *
+* EvtGen is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU General Public License *
+* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
+***********************************************************************/
+
+#ifdef EVTGEN_SHERPA
+
+#include "EvtGenExternal/EvtSherpaPhotons.hh"
+
+#include "EvtGenBase/EvtPhotonParticle.hh"
+#include "EvtGenBase/EvtRandom.hh"
+#include "EvtGenBase/EvtReport.hh"
+#include "EvtGenBase/EvtVector4R.hh"
+
+#include "ATOOLS/Org/MyStrStream.H"
+#include "ATOOLS/Phys/Particle.H"
+#include "SHERPA/Initialization/Initialization_Handler.H"
+#include "SHERPA/Single_Events/Event_Handler.H"
+#include "SHERPA/SoftPhysics/Soft_Photon_Handler.H"
+
+#include <cstring>
+#include <iostream>
+#include <vector>
+
+using std::endl;
+
+EvtSherpaPhotons::EvtSherpaPhotons( const bool useEvtGenRandom,
+ const double infraredCutOff, const int mode,
+ const int useME ) :
+ m_useEvtGenRandom{ useEvtGenRandom },
+ m_infraredCutOff{ infraredCutOff },
+ m_mode{ mode },
+ m_useME{ useME }
+{
+}
+
+void EvtSherpaPhotons::initialise()
+{
+ if ( m_initialised ) {
+ return;
+ }
+
+ EvtGenReport( EVTGEN_INFO, "EvtGen" )
+ << "Setting up Sherpa PHOTONS++ generator for FSR." << endl;
+
+ /* Specify whether we are going to use EvtGen's random number generator
+ * (via EvtSherpaRandom interface) for Sherpa's PHOTONS++ simulation. */
+ if ( m_useEvtGenRandom ) {
+ m_configs.push_back( "SHERPA_LDADD=EvtGenExternal" );
+ m_configs.push_back( "EXTERNAL_RNG=EvtSherpaRandom" );
+ }
+
+ /*
+ * Internal PHOTONS++ settings.
+ * Documentation at
+ * https://sherpa.hepforge.org/doc/Sherpa.html#QED-Corrections
+ */
+
+ /*
+ * YFS_IR_CUTOFF sets the infrared cut-off which serves as a
+ * minimum photon energy in this frame for explicit photon generation.
+ * The default is YFS_IR_CUTOFF = 1E-3 (GeV) but we set it to 1E-7 to equalize
+ * with the cutoff used for PHOTOS.
+ */
+ m_configs.push_back( "YFS_IR_CUTOFF=" + ATOOLS::ToString( m_infraredCutOff ) );
+
+ /*
+ * The keyword YFS_MODE = [0,1,2] determines the mode of operation.
+ * YFS_MODE = 0 switches Photons off.
+ * YFS_MODE = 1 sets the mode to "soft only", meaning soft emissions will be
+ * treated correctly to all orders but no hard emission corrections will be included.
+ * YFS_MODE = 2 these hard emission corrections will also be included up to
+ * first order in alpha_QED. This is the default setting in Sherpa.
+ */
+
+ m_configs.push_back( "YFS_MODE=" + ATOOLS::ToString( m_mode ) );
+
+ /*
+ * The switch YFS_USE_ME = [0,1] tells Photons how to correct hard emissions to
+ * first order in alpha_QED. If YFS_USE_ME = 0, then Photons will use collinearly
+ * approximated real emission matrix elements. Virtual emission matrix elements of
+ * order alpha_QED are ignored. If, however, YFS_USE_ME=1, then exact real and/or
+ * virtual emission matrix elements are used wherever possible.
+ * These are presently available for V->FF, V->SS, S->FF, S->SS, S->Slnu,
+ * S->Vlnu type decays, Z->FF decays and leptonic tau and W decays. For all other
+ * decay types general collinearly approximated matrix elements are used.
+ * In both approaches all hadrons are treated as point-like objects.
+ * The default setting is YFS_USE_ME = 1. This switch is only effective if YFS_MODE = 2.
+ */
+ m_configs.push_back( "YFS_USE_ME=" + ATOOLS::ToString( m_useME ) );
+
+ // TODO: Virtual photon splitting into l+l- will be part of ME corrections from Sherpa 3.0.0 on,
+ // Once released, this should be switched off by default or
+ // taken into account while retrieving the event.
+
+ // Set up run-time arguments for Sherpa.
+ std::vector<char*> argv = this->addParameters();
+
+ // Create instance and initialise Sherpa.
+ m_sherpaGen = std::make_unique<SHERPA::Sherpa>();
+ m_sherpaGen->InitializeTheRun( argv.size(), &argv[0] );
+ m_sherpaGen->InitializeTheEventHandler();
+
+ m_gammaId = EvtPDL::getId( m_photonType );
+ m_gammaPDG = EvtPDL::getStdHep( m_gammaId );
+
+ this->updateParticleLists();
+
+ m_initialised = true;
+}
+
+std::vector<char*> EvtSherpaPhotons::addParameters()
+{
+ std::vector<char*> argv;
+ argv.reserve( m_configs.size() );
+
+ for ( auto& config : m_configs ) {
+ if ( config != "Sherpa" ) {
+ EvtGenReport( EVTGEN_INFO, "EvtGen" )
+ << " EvtSherpaPhotons::initialise: Setting parameter '"
+ << config << "'" << endl;
+ }
+ argv.push_back( config.data() );
+ }
+
+ return argv;
+}
+
+void EvtSherpaPhotons::updateParticleLists()
+{
+ /* Use the EvtGen decay and pdl tables (decay/user.dec and evt.pdl)
+ * to update Sherpa's KF_Table which contains all defined particles
+ * and their properties.
+ * Loop over all entries in the EvtPDL particle data table.
+ */
+ const int nPDL = EvtPDL::entries();
+
+ for ( int iPDL = 0; iPDL < nPDL; iPDL++ ) {
+ const EvtId particleId = EvtPDL::getEntry( iPDL );
+
+ // Sherpa and EvtGen should use the same PDG codes for particles
+ const int PDGCode = EvtPDL::getStdHep( particleId );
+ const long unsigned int particleCode = std::abs( PDGCode );
+
+ // If particle is found in Sherpa's KF_Table, then continue.
+ // Updating the pole mass is not necessary because we provide the 4-momenta
+ // and the final mass for final-state radiation generation.
+ ATOOLS::KFCode_ParticleInfo_Map::const_iterator kf_it(
+ ATOOLS::s_kftable.find( particleCode ) );
+ if ( kf_it != ATOOLS::s_kftable.end() ) {
+ continue;
+ }
+
+ // If the PDG is negative, use the charge conjugated ID because
+ // the KF_Table is defined only for positive PDG numbers.
+ const EvtId particleIdConj = EvtPDL::chargeConj( particleId );
+
+ // Get mass, width, charge and spin
+ const double mass = EvtPDL::getMeanMass( particleId );
+ const double width = EvtPDL::getWidth( particleId );
+ const int charge = PDGCode < 0 ? EvtPDL::chg3( particleIdConj )
+ : EvtPDL::chg3( particleId );
+ const int spin = EvtSpinType::getSpin2(
+ EvtPDL::getSpinType( particleId ) );
+
+ // Use as reference the name of the particle (not anti-particle).
+ const std::string idName = PDGCode < 0 ? particleIdConj.getName()
+ : particleId.getName();
+
+ // Create new entry in the KF_Table. The 0 and 1 in the constructor below
+ // stand for m_on = 0 and m_stable = 1. These properties are irrelevant
+ // for final-state radiation and set to default values.
+ ATOOLS::s_kftable[particleCode] = new ATOOLS::Particle_Info(
+ particleCode, mass, width, charge, spin, 0, 1, idName, idName );
+ }
+}
+
+void EvtSherpaPhotons::doRadCorr( EvtParticle* theParticle )
+{
+ if ( !theParticle ) {
+ return;
+ }
+
+ /* Skip running FSR if the particle has no daughters, since we can't add FSR.
+ * Also skip FSR if the particle has too many daughters (>= 10) as done for PHOTOS.
+ */
+ const int nDaughters( theParticle->getNDaug() );
+ if ( nDaughters == 0 || nDaughters >= 10 ) {
+ return;
+ }
+
+ ATOOLS::Blob_List* blobs = m_sherpaGen->GetEventHandler()->GetBlobs();
+
+ // Use the hadron decay flag always.
+ // Internally, Sherpa handles tau decays in the same way as hadron decays.
+ ATOOLS::Blob* blob = blobs->AddBlob( ATOOLS::btp::Hadron_Decay );
+
+ // Tell Sherpa that the blob needs FSR (that is extra QED)
+ blob->SetStatus( ATOOLS::blob_status::needs_extraQED );
+
+ // Create mother particle and add it to blob
+ ATOOLS::Flavour mother_flav( EvtPDL::getStdHep( theParticle->getId() ) );
+ mother_flav.SetStable( false );
+ const double motherM0 = theParticle->mass();
+ const ATOOLS::Vec4D mother_mom( motherM0, 0., 0., 0. );
+
+ // Add mother to blob with m_number=-1. The m_number will start from 0 for daughters.
+ ATOOLS::Particle* mother_part = new ATOOLS::Particle( -1, mother_flav,
+ mother_mom );
+ mother_part->SetFinalMass( motherM0 );
+ mother_part->SetStatus( ATOOLS::part_status::decayed );
+ // Set m_info="I" (initial) for mother. The m_info will be "F" (final) for daughters.
+ mother_part->SetInfo( 'I' );
+
+ blob->AddToInParticles( mother_part );
+
+ // Add daughters to the blob
+ for ( int iDaug = 0; iDaug < nDaughters; iDaug++ ) {
+ const EvtParticle* theDaughter = theParticle->getDaug( iDaug );
+ ATOOLS::Flavour daughter_flav( EvtPDL::getStdHep( theDaughter->getId() ) );
+ daughter_flav.SetStable( true );
+
+ const double daugE = theDaughter->getP4().get( 0 );
+ const double daugPx = theDaughter->getP4().get( 1 );
+ const double daugPy = theDaughter->getP4().get( 2 );
+ const double daugPz = theDaughter->getP4().get( 3 );
+ const double daugM0 = theDaughter->mass();
+
+ const ATOOLS::Vec4D daughter_mom( daugE, daugPx, daugPy, daugPz );
+
+ ATOOLS::Particle* daughter_part =
+ new ATOOLS::Particle( iDaug, daughter_flav, daughter_mom );
+ daughter_part->SetFinalMass( daugM0 );
+
+ daughter_part->SetStatus( ATOOLS::part_status::active );
+ daughter_part->SetInfo( 'F' );
+
+ blob->AddToOutParticles( daughter_part );
+ }
+
+ const SHERPA::Initialization_Handler* inithandler =
+ m_sherpaGen->GetInitHandler();
+ SHERPA::Soft_Photon_Handler* softphotonhandler =
+ inithandler->GetSoftPhotonHandler();
+
+ // Simulate the radiation
+ softphotonhandler->AddRadiation( blob );
+
+ // Get number of final-state particles
+ const int nFinal( blob->NOutP() );
+
+ // Retrieve the event from Sherpa blob if FSR photons were added
+ if ( nFinal > nDaughters ) {
+ for ( int iLoop = 0; iLoop < nFinal; iLoop++ ) {
+ const ATOOLS::Particle* outParticle = blob->OutParticle( iLoop );
+ const ATOOLS::Vec4D daughter_mom = outParticle->Momentum();
+ const long int pdgId = outParticle->Flav();
+ const EvtVector4R newP4( daughter_mom[0], daughter_mom[1],
+ daughter_mom[2], daughter_mom[3] );
+ const char daugInfo = outParticle->Info();
+
+ if ( iLoop < nDaughters ) {
+ // Update momenta of initial particles
+ EvtParticle* daugParticle = theParticle->getDaug( iLoop );
+ if ( daugParticle ) {
+ daugParticle->setP4WithFSR( newP4 );
+ }
+ } else if ( pdgId == m_gammaPDG && daugInfo == 'S' ) {
+ // Add FSR photons. PHOTONS flags them with info 'S'.
+ // Create a new photon particle and add it to the list of daughters
+ EvtPhotonParticle* gamma = new EvtPhotonParticle();
+ gamma->init( m_gammaId, newP4 );
+ gamma->setFSRP4toZero();
+ gamma->setAttribute( "FSR", 1 );
+ gamma->setAttribute( "ISR", 0 );
+ gamma->addDaug( theParticle );
+ }
+ }
+ }
+
+ return;
+}
+
+#endif
diff --git a/EvtGenExternal/EvtExternalGenList.hh b/src/EvtGenExternal/EvtSherpaRandom.cpp
copy from EvtGenExternal/EvtExternalGenList.hh
copy to src/EvtGenExternal/EvtSherpaRandom.cpp
--- a/EvtGenExternal/EvtExternalGenList.hh
+++ b/src/EvtGenExternal/EvtSherpaRandom.cpp
@@ -18,36 +18,8 @@
* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
***********************************************************************/
-#ifndef EVTEXTERNALGENLIST_HH
-#define EVTEXTERNALGENLIST_HH
+#ifdef EVTGEN_SHERPA
-#include "EvtGenBase/EvtAbsRadCorr.hh"
-#include "EvtGenBase/EvtDecayBase.hh"
-
-#include <list>
-
-// Description: A factory type method to create engines for external physics
-// generators like Pythia.
-
-class EvtExternalGenList {
- public:
- EvtExternalGenList( bool convertPythiaCodes = false,
- std::string pythiaXmlDir = "",
- std::string photonType = "gamma",
- bool useEvtGenRandom = true );
-
- virtual ~EvtExternalGenList();
-
- std::list<EvtDecayBase*> getListOfModels();
-
- EvtAbsRadCorr* getPhotosModel( const double infraredCutOff = 1.0e-7,
- const double maxWtInterference = 64.0 );
-
- protected:
- private:
- std::string m_photonType;
-
- bool m_useEvtGenRandom;
-};
+#include "EvtGenExternal/EvtSherpaRandom.hh"
#endif
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -34,7 +34,7 @@
if (EVTGEN_HEPMC3)
target_compile_definitions(${test_exe} PRIVATE EVTGEN_HEPMC3)
endif()
- if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA )
+ if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA OR EVTGEN_SHERPA )
target_compile_definitions(${test_exe} PRIVATE EVTGEN_EXTERNAL)
target_link_libraries(${test_exe} PRIVATE EvtGenExternal)
endif()
diff --git a/test/testDecayModel.cc b/test/testDecayModel.cc
--- a/test/testDecayModel.cc
+++ b/test/testDecayModel.cc
@@ -113,9 +113,7 @@
m_config.at( "models" ).get<std::vector<std::string>>() };
const auto modelParameters{
m_config.at( "parameters" ).get<std::vector<std::vector<std::string>>>() };
- const auto outFileName{ m_config.at( "outfile" ).get<std::string>() };
const auto nEvents{ m_config.at( "events" ).get<int>() };
- const auto refFileName{ m_config.at( "reference" ).get<std::string>() };
// Then check for optional fields, setting default values if not present
@@ -131,6 +129,31 @@
? m_config.at( "extras" ).get<std::vector<std::string>>()
: std::vector<std::string>{} };
+ // Set the FSR generator. Use PHOTOS by default.
+ const auto fsrGenerator{
+ ( m_config.contains( "fsr_generator" ) )
+ ? m_config.at( "fsr_generator" ).get<std::string>()
+ : "PHOTOS" };
+
+ // Set reference and output file names, insert fsrGenerator name if FSR simulation is not deactivated
+ const bool noFSR = std::find( extraCommands.begin(), extraCommands.end(),
+ "noFSR" ) != extraCommands.end();
+
+ const std::string fileNameEnd = noFSR ? ".root"
+ : "_" + fsrGenerator + ".root";
+
+ const auto outFileStrSize =
+ m_config.at( "outfile" ).get<std::string>().size() - 5;
+ const auto refFileStrSize =
+ m_config.at( "reference" ).get<std::string>().size() - 5;
+
+ const auto outFileName =
+ m_config.at( "outfile" ).get<std::string>().substr( 0, outFileStrSize ) +
+ fileNameEnd;
+ const auto refFileName =
+ m_config.at( "reference" ).get<std::string>().substr( 0, refFileStrSize ) +
+ fileNameEnd;
+
const auto debugFlag{ ( m_config.contains( "debug_flag" ) &&
m_config.at( "debug_flag" ).is_boolean() )
? m_config.at( "debug_flag" ).get<bool>()
@@ -159,7 +182,19 @@
bool convertPythiaCodes( false );
bool useEvtGenRandom( true );
EvtExternalGenList genList( convertPythiaCodes, "", "gamma", useEvtGenRandom );
- radCorrEngine = genList.getPhotosModel();
+ if ( fsrGenerator == "PHOTOS" ) {
+ radCorrEngine = genList.getPhotosModel();
+ } else if ( fsrGenerator == "SherpaPhotons1" ) {
+ radCorrEngine = genList.getSherpaPhotonsModel( 1e-7, 1, 0 );
+ } else if ( fsrGenerator == "SherpaPhotons20" ) {
+ radCorrEngine = genList.getSherpaPhotonsModel( 1e-7, 2, 0 );
+ } else if ( fsrGenerator == "SherpaPhotons21" ) {
+ radCorrEngine = genList.getSherpaPhotonsModel( 1e-7, 2, 1 );
+ } else {
+ std::cerr << "ERROR: The option fsr_generator = '" << fsrGenerator
+ << "' is not supported. " << std::endl;
+ return false;
+ }
extraModels = genList.getListOfModels();
#endif
@@ -811,12 +846,19 @@
value = p1.get( 3 );
} else if ( !selectedVarName.compare( "cosHel" ) ||
- !selectedVarName.compare( "absCosHel" ) ) {
+ !selectedVarName.compare( "absCosHel" ) ||
+ !selectedVarName.compare( "cosHelParent" ) ) {
// Cosine of helicity angle
EvtVector4R p12;
EvtVector4R p1Res;
- if ( d2 != 0 ) {
+ if ( !selectedVarName.compare( "cosHelParent" ) ) {
+ p12 = selectedParent->getP4Lab();
+ const EvtVector4R boost{ p12.get( 0 ), -p12.get( 1 ), -p12.get( 2 ),
+ -p12.get( 3 ) };
+ // Momentum of particle d1 in resonance frame, p1Res
+ p1Res = boostTo( p1_lab, boost );
+ } else if ( d2 != 0 ) {
// Resonance center-of-mass system (d1 and d2)
p12 = p1_lab + p2_lab;
// Boost vector
@@ -1387,8 +1429,10 @@
int main( int argc, char* argv[] )
{
- if ( argc != 2 ) {
- std::cerr << "Expecting one argument: json input file" << std::endl;
+ if ( argc != 2 && argc != 3 ) {
+ std::cerr << "Expecting at least one argument: json input file."
+ << "\nOne additional argument supported for fsrGenerator"
+ << std::endl;
return 1;
}
@@ -1398,6 +1442,10 @@
inputStr >> config;
inputStr.close();
+ if ( argc == 3 ) {
+ config["fsr_generator"] = argv[2];
+ }
+
bool allOK{ true };
if ( config.is_array() ) {
for ( const auto& cc : config ) {
diff --git a/validation/CMakeLists.txt b/validation/CMakeLists.txt
--- a/validation/CMakeLists.txt
+++ b/validation/CMakeLists.txt
@@ -33,7 +33,7 @@
if (EVTGEN_HEPMC3)
target_compile_definitions(${validation_exe} PRIVATE EVTGEN_HEPMC3)
endif()
- if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA )
+ if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA OR EVTGEN_SHERPA)
target_compile_definitions(${validation_exe} PRIVATE EVTGEN_EXTERNAL)
target_link_libraries(${validation_exe} PRIVATE EvtGenExternal)
endif()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 8:31 PM (6 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3791413
Default Alt Text
D115.id496.diff (56 KB)
Attached To
D115: Implement Sherpa's PHOTONS++ as alternative for final-state radiation
Event Timeline
Log In to Comment